Not extracting all member of AEM group when user do not have admin rights. | Community
Skip to main content
chetan001
Level 3
Sep 15, 2021 11:59 AM UTC
Solved

Not extracting all member of AEM group when user do not have admin rights.

Hello All,

 

As a admin user I see all members are extracting  from AEM group. But when user have less access then he is not able to extract other users

 

Working Case : =  Admin User , he can extract all three users

 

Group Name : regional_asia

Member  :  user1, user2,user3

 

 

 

Problem Case:

 

Login User :=  User1  “ he does not have admin access”, has less access, so when extracting user, he only able to extract itself ,not user2 and user3

 

Group Name : regional_asia

Member  :  user1, user2,user3

 

 

 

Code :

 

group = (Group) userManager.getAuthorizable(Constants.GROUP_EDITOR_APAC);

if(group != null) {

                           final Iterator<Authorizable> memberslist = group.getMembers();

                           while (memberslist.hasNext()) {

                                  final Authorizable user = memberslist.next();

                                  if (user != null && !user.isGroup() && user.getProperty("./profile/email") != null) {

                                         //EMAIL ADDRESS FOR MEMBERS

                                         Value[] usrEmail = user.getProperty("./profile/email");

                                         for(Value emailGroup : usrEmail) {

                                                String member = emailGroup.toString()

}

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Asutosh_Jena_
Asutosh_Jena_Accepted solution
New Participant
Sep 15, 2021 12:22 PM UTC

Hi @chetan001 

 

Please create a system user and assign appropriate path permission to the system user.

Now using the system user in your code, try to access the userManager API and it will have the same behavior as of admin user.

 

Here is the link which talks about the creation of system user:

https://www.argildx.com/technology/ensure-service-user-an-acs-aem-commons-utility/

 

Thanks!

2 replies

joerghoh
Employee
Sep 17, 2021 7:41 PM UTC

This is a permission topic. By default a user just has access to its own account, and does not see other users which are also able to login into the system. 

If you cannot give the users general read access to the user nodes of the other users (I would not do that), but just want to display other users in a very specific context, you can use a ResourceResolver/Session with elevated privileges as @asutosh_jena_  already mentioned.

Translate
Asutosh_Jena_
Asutosh_Jena_Accepted solution
New Participant
Sep 15, 2021 12:22 PM UTC

Hi @chetan001 

 

Please create a system user and assign appropriate path permission to the system user.

Now using the system user in your code, try to access the userManager API and it will have the same behavior as of admin user.

 

Here is the link which talks about the creation of system user:

https://www.argildx.com/technology/ensure-service-user-an-acs-aem-commons-utility/

 

Thanks!

Translate