- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2020 11:00 PM
Does anyone have any experience working with the GlideSecurityManager API?
I'm looking to update a user's roles dynamically without the need for them to sign out and then sign back in and came across some really interesting posts on the GlideSecurityManager but I cannot get it to work with the Service Portal.
If I make a really simple portal widget with the following code...
(function() {
console.log('ROLES BEFORE')
console.log(GlideSecurityManager.get().getRoles(true))
GlideSecurityManager.get().setUser(gs.getUser())
console.log('ROLES AFTER')
console.log(GlideSecurityManager.get().getRoles(true))
console.log('But this never registers with the GlideSession')
console.log(gs.getUser().hasRole('itil'))
})();
And then sign in using an incognito window as the user in question with their old roles... if I update their roles from my admin session and refresh this portal page, I see...
In other words, the GlideSecurityManager appears to have worked and picked up the new roles (including ITIL), but they don't get set properly in the session so gs.getUser().hasRole('ITIL') fails
Refreshing the incognito session repeats the exact screenshot again (ie, the before roles are still the only recognized roles even though GlideSecurityManager.get().setUser() has already run once before and the roles were changed some time ago in my admin session.
Anyone got any ideas on how this could be done without terminating the user session and getting them to sign back in?
Solved! Go to Solution.
- Labels:
-
Multiple Versions
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2021 01:46 AM
Well... Better now than never. We found solution to the problem described by you: https://github.com/zhmur/servicenow-guides/blob/master/Dirty%20hacks.md .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Anyone know if this still works? I tried the above and not having much luck

