<?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 Re: Bulk upload users in group in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/bulk-upload-users-in-group/m-p/116800#M32344</link>
    <description>&lt;P&gt;Please check this link which explains how to do this via a CSV file.&lt;/P&gt;</description>
    <pubDate>Fri, 22 Nov 2019 15:34:23 GMT</pubDate>
    <dc:creator>jljwoznica</dc:creator>
    <dc:date>2019-11-22T15:34:23Z</dc:date>
    <item>
      <title>Bulk upload users in group</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/bulk-upload-users-in-group/m-p/116798#M32342</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to add a number of users in a group.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let'us say i have 200 users in alfresco, so i want to add first 100 users in one group and another 100 users in an another group. how should i achive this.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;please guide me.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 08:39:46 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/bulk-upload-users-in-group/m-p/116798#M32342</guid>
      <dc:creator>Balaji123</dc:creator>
      <dc:date>2019-11-22T08:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk upload users in group</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/bulk-upload-users-in-group/m-p/116799#M32343</link>
      <description>&lt;P&gt;I am not sure if there is a way to achieve this OOTB. However, you can create a javascript or java backed webscript and do this easily.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example of java backed webcript process:&lt;/P&gt;
&lt;P&gt;You can pass the list of users and GroupId (e.g. GROUP_XYZGROUP) to the webscript and iterate each userId and get the person NodeRef using &lt;A href="https://dev.alfresco.com/resource/docs/java/org/alfresco/service/cmr/security/PersonService.html" target="_self" rel="nofollow noopener noreferrer"&gt;PersonService&lt;/A&gt; (&lt;EM&gt;org.alfresco.service.cmr.security.PersonService&lt;/EM&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;NodeRef personRef = personService.getPerson(userId);&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;You can use &lt;A href="https://dev.alfresco.com/resource/docs/java/org/alfresco/repo/security/authority/AuthorityDAO.html" target="_self" rel="nofollow noopener noreferrer"&gt;AuthorityDAO&lt;/A&gt;&amp;nbsp;(&lt;EM&gt;org.alfresco.repo.security.authority.AuthorityDAO&lt;/EM&gt;)service to get the groupNodeRef based on groupId you passed:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;NodeRef groupNodeRef =&amp;nbsp;authorityDAO.getAuthorityNodeRefOrNull(groupId);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Once you get groupNodeRef, call below given method (&lt;EM&gt;sample method, you can create your own if needed&lt;/EM&gt;) and pass the group Noderef and person nodeRef to it. You would need &lt;A href="http://dev.alfresco.com/resource/AlfrescoOne/5.0/PublicAPI/org/alfresco/service/cmr/repository/NodeService.html" target="_self" rel="nofollow noopener noreferrer"&gt;NodeService&lt;/A&gt; and &lt;A href="https://dev.alfresco.com/resource/docs/java/org/alfresco/service/cmr/security/AuthorityService.html" target="_self" rel="nofollow noopener noreferrer"&gt;AuthorityService&lt;/A&gt; for this call.&lt;/P&gt;


&lt;PRE&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/PRE&gt;
&lt;PRE&gt;private void addUserToGroup(NodeRef groupNodeRef,
	NodeRef personRef, NodeService nodeService,
	AuthorityService authorityService) {
	if (nodeService.getType(groupNodeRef).equals(ContentModel.TYPE_AUTHORITY_CONTAINER)) {
		String parentGroupName = (String) nodeService.getProperties(groupNodeRef).get(ContentModel.PROP_AUTHORITY_NAME);
		String authorityName = StringUtils.EMPTY;
		if (nodeService.getType(personRef).equals(ContentModel.TYPE_AUTHORITY_CONTAINER)){
			authorityName = (String) nodeService.getProperties(personRef).get(ContentModel.PROP_AUTHORITY_NAME);
		} else{
			authorityName = (String) nodeService.getProperties(personRef).get(ContentModel.PROP_USERNAME);
		}
		authorityService.addAuthority(parentGroupName, authorityName);
	}
}&lt;/PRE&gt;
&lt;PRE&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Nov 2019 15:28:50 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/bulk-upload-users-in-group/m-p/116799#M32343</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2019-11-22T15:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk upload users in group</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/bulk-upload-users-in-group/m-p/116800#M32344</link>
      <description>&lt;P&gt;Please check this link which explains how to do this via a CSV file.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 15:34:23 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/bulk-upload-users-in-group/m-p/116800#M32344</guid>
      <dc:creator>jljwoznica</dc:creator>
      <dc:date>2019-11-22T15:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk upload users in group</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/bulk-upload-users-in-group/m-p/116801#M32345</link>
      <description>&lt;P&gt;Definitely can do this with code as others have suggested, but I thought I'd give you some additional food for thought...&lt;/P&gt;
&lt;P&gt;You might consider using an LDAP directory to manage your users and groups. Then you can do such things easily using the directory management tools associated with whatever directory you are using, and Alfresco will happily sync everything over.&lt;/P&gt;
&lt;P&gt;The side-benefit, of course, is that other applications in your enterprise can also benefit from having a centralized directory. Plus, it is a lot easier to delegate administration of users and groups using an LDAP directory than it is with Alfresco natively.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 18:46:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/bulk-upload-users-in-group/m-p/116801#M32345</guid>
      <dc:creator>jpotts</dc:creator>
      <dc:date>2019-11-22T18:46:19Z</dc:date>
    </item>
  </channel>
</rss>

