Webscript to create a new (emergency) admin user in Alfresco.
- Copy to alfresco/extension/templates/webscripts/
- restart Alfresco
- Call the URL: [http://localhost:8080/alfresco/service/server/createadmin]
- Log in with localadmin / localadmin
<webscript> | |
<shortname>create admin user</shortname> | |
<description>creates an user called localAdmin and add it to the admingroup</description> | |
<url>/server/createadmin</url> | |
<format default="json">argument</format> | |
<authentication runas="admin">none</authentication> | |
<transaction>required</transaction> | |
</webscript> |
function createUser(username, firstname, lastname, email) | |
{ | |
var password = username; | |
var p = people.createPerson(username, firstname, lastname, email, password, true); | |
if (p) p.save(); | |
} | |
function main() | |
{ | |
var userName = 'localadmin'; | |
createUser(userName, 'Local','Admin', '[email protected]'); | |
var adminGroup = groups.getGroup('ALFRESCO_ADMINISTRATORS'); | |
adminGroup.addAuthority(userName); | |
} | |
main(); |
{ | |
"success" : true | |
} |
Webscript to create a new (emergency) admin user in Alfresco.