Hi All,
I have created a group in userAdmin and it has some users attached to it.
And in my java class I want to get the list of users attached to the group, but somehow I am not able to find any API or some way to find it out.
Finding the Group to which a user is attached I know, but dont know how to find out the list of users in a group in my java code.
Any suggestion on this will be really appreciated.
Solved! Go to Solution.
Views
Replies
Total Likes
Pls follow this tutorial : http://helpx.adobe.com/experience-manager/using/developing-aem-osgi-bundles-jackrabbit.html
If you want to see the group associated with user then see below -
User currentUser = resourceResolver.adaptTo(User.class);
Iterator<Group> currentUserGroups = currentUser.memberOf();
Views
Replies
Total Likes
If you the have the org.apache.jackrabbit.api.security.user.Authorizable for the group (and you are sure it's a group) you can cast to org.apache.jackrabbit.api.security.user.Group, and then call Group.getMembers. If you aren't sure it's a group you can call Authorizable.isGroup before you do the cast.
Views
Replies
Total Likes
Pushp Dang wrote...
And in my java class I want to get the list of users attached to the group, but somehow I am not able to find any API or some way to find it out.
Finding the Group to which a user is attached I know, but dont know how to find out the list of users in a group in my java code.
Any suggestion on this will be really appreciated.
If you have the group, you can use group.getMembers() See: http://wiki.apache.org/jackrabbit/UserManagement fetch members from a group section
Zyg
Views
Replies
Total Likes
Pls follow this tutorial : http://helpx.adobe.com/experience-manager/using/developing-aem-osgi-bundles-jackrabbit.html
If you want to see the group associated with user then see below -
User currentUser = resourceResolver.adaptTo(User.class);
Iterator<Group> currentUserGroups = currentUser.memberOf();
Views
Replies
Total Likes
Views
Likes
Replies