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
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

How to get the immediate group details only for a particular user

aem_dev1
Level 3
Level 3

Hello,

I am using jackrabbit user manager to find out all the users in AEM repository. With userManager.finAuthorizables(Query) able to find out all the users. I want to get the immediate groups names of every user returned from above method.

For example if user "test" belongs "test-group" and if "test-group" belongs to "contributors" and when i say user.memberOf() (for test user), it is returning both "test-group" and "contributors" in group iterator. But i am interested to see only the immediate group ("test-group" only in above example.

Appreciated for a quick response.

1 Accepted Solution
edubey
Correct answer by
Level 10
Level 10

Yeah right, then I think you should write a custom service which will evaluate all possibilities and then return you the result.

How many approx user and groups do you have?

View solution in original post

4 Replies
bsloki
Community Advisor
Community Advisor

Essentially, it lists all the groups which Users belongs to. I dont think any API available for this. What is the usecase you which needs this ?

edubey
Level 10
Level 10

Few thoughts,

If its returning all the groups, it might return in a particular order. example from immediate to higher. Test this, and if order is same for all result then you get the index[0] of the returned array of group names.

aem_dev1
Level 3
Level 3

It will return groups from immediate to higher, but we can't say how many immediate groups that user belongs to. If user assigned to multiple groups, index 0 will just give one immediate group and we dont know how many immediate groups were there.  

edubey
Correct answer by
Level 10
Level 10

Yeah right, then I think you should write a custom service which will evaluate all possibilities and then return you the result.

How many approx user and groups do you have?

View solution in original post