Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Use GlideSecurityManager.get() to reset the user's security profile

tomas6
Kilo Explorer

I have created this UI action, which adds the snc_read_only role to the user. The problem I'm having is that sometimes after I log out and back in - even though the role has been created in the sys_user_has_role table and is showing in the user's related roles list - it is not active, and the user can still enjoy full administrator rights. If I log out twice it works 100% correctly

find_real_file.png

the script action:

find_real_file.png

I have tried adding the GlideSecurityManager.get(); which should in theory refresh the user's profile, but it made no difference whatsover 😞

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1 REPLY 1

Alikutty A
Tera Sage

The session might be still active, I guess you would need to invalidate the user session after the access is removed

Please refer this post to see on how it can be done - https://community.servicenow.com/community?id=community_question&sys_id=725587addbd8dbc01dcaf3231f9619ac

Thanks!