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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list
SOLVED

How to read id(9wMp6sGyejwQn-rzopsh) based on the user login programatically

Avatar

Level 2

Can you please help me with how to read id(9wMp6sGyejwQn-rzopsh) based on the user login. How to EX: If admin user login then need to display this id: 9wMp6sGyejwQn-rzopsh

 

Screenshot 2021-07-18 at 9.32.52 PM.png

 

@Bimmi_Soi@Kiran_Vedantam

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @kotireddy4b1 

 You should be simple able to get it from Authorizable 

Sample code snippet:

 Session session = resourceResolver.adaptTo(Session.class);
 UserManager userManager = resourceResolver.adaptTo(UserManager.class);
Authorizable auth = userManager.getAuthorizable(session.getUserID());

 from this you can simply get id or path of logged in user.

 

Thanks

Dipti

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi @kotireddy4b1 

 You should be simple able to get it from Authorizable 

Sample code snippet:

 Session session = resourceResolver.adaptTo(Session.class);
 UserManager userManager = resourceResolver.adaptTo(UserManager.class);
Authorizable auth = userManager.getAuthorizable(session.getUserID());

 from this you can simply get id or path of logged in user.

 

Thanks

Dipti

The ultimate experience is back.

Join us in Vegas to build skills, learn from the world's top brands, and be inspired.

Register Now