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

Avatar

Avatar
Validate 1
Level 1
kotireddy4b1
Level 1

Likes

0 likes

Total Posts

15 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
kotireddy4b1
Level 1

Likes

0 likes

Total Posts

15 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
kotireddy4b1
Level 1

18-07-2021

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@KiranVedantam1992

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 100
Level 6
Dipti_Chauhan
Level 6

Likes

114 likes

Total Posts

136 posts

Correct reply

40 solutions
Top badges earned
Boost 100
Give Back 10
Affirm 25
Boost 50
Boost 25
View profile

Avatar
Boost 100
Level 6
Dipti_Chauhan
Level 6

Likes

114 likes

Total Posts

136 posts

Correct reply

40 solutions
Top badges earned
Boost 100
Give Back 10
Affirm 25
Boost 50
Boost 25
View profile
Dipti_Chauhan
Level 6

18-07-2021

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

Answers (0)