How to get the immediate group details only for a particular user | Community
Skip to main content
aem_dev1
Level 3
October 16, 2015
Solved

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

  • October 16, 2015
  • 4 replies
  • 1116 views

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.

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 edubey

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?

4 replies

Lokesh_Shivalingaiah
Level 10
October 16, 2015

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
October 16, 2015

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
aem_dev1Author
Level 3
October 16, 2015

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
edubeyAccepted solution
Level 10
October 16, 2015

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?