Expand my Community achievements bar.

SOLVED

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

Avatar

Level 4

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()

}

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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!

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

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!

Avatar

Employee Advisor

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.