Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

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

Avatar

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

Avatar

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

Avatar

Level 10

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 ?

Avatar

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.

Avatar

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.  

Avatar

Correct answer by
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?