<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic create new users without admin rights in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/create-new-users-without-admin-rights/m-p/88988#M26681</link>
    <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.alfresco.com/5.0/references/RESTful-PersonPeoplePost.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://docs.alfresco.com/5.0/references/RESTful-PersonPeoplePost.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 11 Dec 2019 13:26:12 GMT</pubDate>
    <dc:creator>sebaminatti</dc:creator>
    <dc:date>2019-12-11T13:26:12Z</dc:date>
    <item>
      <title>create new users without admin rights</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/create-new-users-without-admin-rights/m-p/88988#M26681</link>
      <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.alfresco.com/5.0/references/RESTful-PersonPeoplePost.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://docs.alfresco.com/5.0/references/RESTful-PersonPeoplePost.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 13:26:12 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/create-new-users-without-admin-rights/m-p/88988#M26681</guid>
      <dc:creator>sebaminatti</dc:creator>
      <dc:date>2019-12-11T13:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: create new users without admin rights</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/create-new-users-without-admin-rights/m-p/88989#M26682</link>
      <description>&lt;P&gt;No, People API (POST /alfresco/service/api/people) requires admin level authentication in order to exeute the request.&lt;/P&gt;
&lt;PRE&gt;   &amp;lt;url&amp;gt;/api/people&amp;lt;/url&amp;gt;
   &amp;lt;format default="json"&amp;gt;argument&amp;lt;/format&amp;gt;
 &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;  &amp;lt;authentication&amp;gt;admin&amp;lt;/authentication&amp;gt;&lt;/STRONG&gt;&lt;/FONT&gt;
   &amp;lt;transaction&amp;gt;required&amp;lt;/transaction&amp;gt;&lt;/PRE&gt;
&lt;P&gt;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. if you want to limit the API to a limited user (e.g. users who recieve tickets to add users via service desk), then create a group in alfresco and add those users to the group.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Something like:&lt;/U&gt;&lt;/P&gt;
&lt;PRE&gt;LOGGER.info("Creating user...");
//user creation process requires administrator privileges
String currentUser = AuthenticationUtil.getFullyAuthenticatedUser();
AuthenticationUtil.setRunAsUserSystem();
try {
	//TODO:: Your code to create user.&lt;BR /&gt;        //Check if user is part of the group then proceed with user creation else throw error.
	//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
	AuthenticationUtil.setFullyAuthenticatedUser(currentUser);
}
LOGGER.info("User created successfully!");&lt;/PRE&gt;
&lt;P&gt;You would have to mainly use following repository services in order to create user using your custom webscript.&lt;/P&gt;
&lt;P&gt;1- org.alfresco.service.cmr.repository.NodeService;&lt;BR /&gt;2- org.alfresco.service.cmr.security.AuthorityService;&lt;BR /&gt;3- org.alfresco.service.cmr.security.MutableAuthenticationService;&lt;BR /&gt;4- org.alfresco.service.cmr.security.PersonService;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 16:49:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/create-new-users-without-admin-rights/m-p/88989#M26682</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2019-12-12T16:49:06Z</dc:date>
    </item>
  </channel>
</rss>

