11-17-2016 09:18 AM
Hello,
Is there any way of getting the list of all UserGroups and SubUserGroups of a Site?
Currently I see only method listMembers() which returns only the list of Users, not the groups.
Thank you in advance.
11-19-2016 10:10 AM
When you want to get all the users and/or groups within sites you may also always use the AuthorityService API to list them. The SiteService API only provides the convenience operations that are needed e.g. to provide site management functionality in the UI. SiteService.getSiteGroup(shortName) gets you the Alfresco group that contains all the roles of the site, and transitively all the groups / users. You can use that in conjunction with AuthorityService.getContainedAuthorities(authorityType, name, immediate) to retrieve members.
11-17-2016 10:45 PM
You can try listMembers method and set argument collapseGroups=true.
11-21-2016 04:14 AM
This again returns all users, but not the group of users.
I want to get for example -> <GROUP_test, role> (which contain users: user1, user2) and after that get the List of that group which should return - user1, user2;
Instead I get -> <user1, role>, <user2, role> from the map which return that method.
11-21-2016 06:09 AM
Ok, so for my case it should be =false and it works
11-19-2016 10:10 AM
When you want to get all the users and/or groups within sites you may also always use the AuthorityService API to list them. The SiteService API only provides the convenience operations that are needed e.g. to provide site management functionality in the UI. SiteService.getSiteGroup(shortName) gets you the Alfresco group that contains all the roles of the site, and transitively all the groups / users. You can use that in conjunction with AuthorityService.getContainedAuthorities(authorityType, name, immediate) to retrieve members.
11-21-2016 04:16 AM
Is there any way not specifying the authorityType? Otherwise I have to foreach them role by role, right?
11-21-2016 04:37 AM
You can simply provide authorityType as null and both groups AND users will be returned. The authorityType has nothing to do with the site role - these can be differentiated via SiteService.getSiteRoleGroup(shortName, roleName)
11-21-2016 06:41 AM
For the method - authorityService.getContainedAuthorities(authorityType, name, immediate);
Could you please tell me what exactly the paramether name (the name of the containing authority) means.
The GroupName of a Site or ? As I receive nullpointer exception...
11-21-2016 07:42 AM
Obviously it refers to the name of the authority of which to get the contained authorities. In this case it needs the full authority name as returned by the SiteService.getSiteRoleGroup(shortName, role) or SiteService.getSiteGroup(shortName)
11-21-2016 07:55 AM
Yes, I tried with both, but currently trying to investigate from where it returns null pointer exception.
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.