Assignment of a role to a user only active after logout login?

Meloper
Kilo Sage

Hi,

user is active and logged in (active session)

i assign this user a role during that session

Normaly user has to logout and log in again to have that new "Permission".

Is there an option to "activate" that new assigned role without logout ?

So that the user has no action and "feels/see" no action?

 

Something like, GlideSessions.loadnewroles(); ? 😄
 

3 REPLIES 3

Community Alums
Not applicable

Hi @Meloper ,

Unfortunately NO, the user has to do that bit at minimum for the role/ permission to be allocated.

 

GlideUser object update

There is a common business requirement to update users roles dynamically without asking them to re-login. Well-known solution using GlideSecurityManager will help only partially because it will not refresh GlideUser object. As a result method gs.getUser().hasRole('itil') will fail (will check against "old" list of roles). Solution is available down below. Big "Thank you" goes to @icerge.

var user = gs.getUser();

// Refresh GlideSession object
GlideSecurityManager.get().setUser(user);

// Refresh GlideUser object
gs.getSession().loadUserByID(user.getID());

Dr Atul G- LNG
Tera Patron
Tera Patron

 Hi @Meloper 

 

Are you talking about elevated role?

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************