Saturday 12 April 2014

Quick way to get all the users of a specific group

Consider a scenario where on your production server, you have thousands of groups and thousands of users.

Now, at some point of time, you need to find out all the users belonging to some specific group.

There is obviously a way, where in you can just login to alfresco and search for a group and find out users from that group. But do keep in mind that, this will take some time to give you the result. You also need to be careful while entering the search criteria like you are searching for All root groups or children groups.

Instead, To make your job simpler, You can use below webscript to get this done quickly for you. Putting it here for quick easy handy reference. I am sure this will be helpful to you at some point of time.
http://server:port/alfresco/service/api/groups/{groupName}/children?authorityType=USER

Example usage -
http://localhost:8080/alfresco/service/api/groups/TEST_GROUP/children?authorityType=USER

Note :
There is also an option that you can query for all sub groups of the given group. You need to pass authorityType as GROUP.

Thanks,
Ramesh C

2 comments:

  1. Hi Ramesh,

    Is there any way to get the user count of a specific site/folder in alfresco.

    Thanks

    ReplyDelete
    Replies
    1. Hi,

      You can try out JavaScript API for site service i.e. site.listMembers(null, null, 0, true) to get the members of a specific site and see if this works for you or not.

      Thanks

      Delete