create new users without admin rights

Showing results for 
Search instead for 
Did you mean: 
Member II

create new users without admin rights

I am currently working on a web client(usging alfresco REST API) to signup new users but I am wondering if I can sigunup new users without using admin credentials.

1 Reply

Re: create new users without admin rights

No, People API (POST /alfresco/service/api/people) requires admin level authentication in order to exeute the request.

   <format default="json">argument</format>

However, you can create your custom webcript/rest api which can be authenticated using a general user and can be used to create users by wrapping the transaction under system user.

Something like:"Creating user...");
//user creation process requires administrator privileges
String currentUser = AuthenticationUtil.getFullyAuthenticatedUser();
try {
	//TODO:: Your code to create user.
	//write response for the request
} catch (InvalidNodeRefException | IllegalArgumentException
		| IOException | AlfrescoRuntimeException excp) {
	LOGGER.error("Exception occurred while creating the user", excp);
	throw new WebScriptException(Status.STATUS_INTERNAL_SERVER_ERROR, excp.getMessage(),excp);
} finally {
	AuthenticationUtil.clearCurrentSecurityContext(); //Clear system user context and set original user context
}"User created successfully!");

You would have to mainly use following repository services in order to create user using your custom webscript.

1- org.alfresco.service.cmr.repository.NodeService;