Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How to identify a User belongs to a nested Group

vasimakram
Level 4
Level 4

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

1 Accepted Solution
vasimakram
Correct answer by
Level 4
Level 4

Found the solution.

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

Thank you.

View solution in original post

0 Replies
smacdonald2008
Level 10
Level 10

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

vasimakram
Level 4
Level 4

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
Correct answer by
Level 4
Level 4

Found the solution.

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

Thank you.

View solution in original post