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

AEM6.5 how to get user details and the groups the user is associated to in author environment

Avatar

Avatar
Validate 25
Level 4
srinivas_chann1
Level 4

Likes

19 likes

Total Posts

222 posts

Correct Reply

6 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile

Avatar
Validate 25
Level 4
srinivas_chann1
Level 4

Likes

19 likes

Total Posts

222 posts

Correct Reply

6 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Ignite 5
Ignite 3
View profile
srinivas_chann1
Level 4

04-01-2021

Hi,

 

Once any user  logs in to the author environment how could I get the details of the groups the user is member of.

 

I am using js so wanted to check if there is any json available through which I could get this details. Instead of me building a new code for this.

 

I noticed that for authorizables.json  we need to provide the username.

http://localhost:4502/bin/security/authorizables.json?filter=username&_charset_=utf-8

 

Now if is the case i would need a way to find the user name in the js and then again send the request. 

 

Please let me know as I could resolve this in a better way .

 

 

Thanks

View Entire Topic

Avatar

Avatar
Springboard
MVP
Suraj_Kamdi
MVP

Likes

142 likes

Total Posts

155 posts

Correct Reply

41 solutions
Top badges earned
Springboard
Validate 1
Establish
Contributor
Ignite 3
View profile

Avatar
Springboard
MVP
Suraj_Kamdi
MVP

Likes

142 likes

Total Posts

155 posts

Correct Reply

41 solutions
Top badges earned
Springboard
Validate 1
Establish
Contributor
Ignite 3
View profile
Suraj_Kamdi
MVP

04-01-2021

@srinivas_chann1 

I would suggest using the service user to get the details of AEM user/groups. Make use of Authorizable API

https://helpx.adobe.com/experience-manager/6-5/sites/developing/using/reference-materials/javadoc/or... 

 

see the following code snippet

 

 

public static Group getGroup(String userId, UserManager userManager) {
    try {
      return (Group) userManager.getAuthorizable(userId);
    } catch (RepositoryException e) {
      logger.error("Error {}", e);
    }
    return null;
  }