How to identify a User belongs to a nested Group | Community
Skip to main content
vasimakram
Level 4
July 17, 2017
Solved

How to identify a User belongs to a nested Group

  • July 17, 2017
  • 3 replies
  • 1685 views

Hi,

I have a AEM user say X. I have two groups A and B. User X is member of Group B and Group B is member of Group A. How to identify Whether X is a member of A?

Thanks in advance

Regards,

Vasim

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by vasimakram

Found the solution.

If I use requiredGroup.isMember(authorizableUser); It is working.

Thank you.

3 replies

smacdonald2008
Level 10
July 17, 2017

You can use the JackRabbit UserManager API to get this type of information -- UserManager (Apache Jackrabbit 2.6.8 API)

vasimakram
Level 4
July 17, 2017

I tried following code. Still it is not working.

Authorizable authorizableUser = userManager.getAuthorizable("X");

Authorizable authorizableGroup = userManager.getAuthorizable("A");

if(authorizableGroup != null && authorizableGroup.isGroup()){

     Group requiredGroup= (Group) authorizableGroup;

     System.out.println(requiredGroup.isDeclaredMember(authorizableUser););

}

It is not even considering X as a member of Group A. In useradmin for user X it showing only Group B. It is not even considering X is a member of Group A.

vasimakram
vasimakramAuthorAccepted solution
Level 4
July 17, 2017

Found the solution.

If I use requiredGroup.isMember(authorizableUser); It is working.

Thank you.