I want to allow impersonate user access to a custom role.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2023 10:17 PM
I want to restrict impersonate user access to users who are having a custom role impersonate_user role. I have customized this script include "ImpersonateEvaluator" as below but not working as expected
var ImpersonateEvaluator = Class.create();
ImpersonateEvaluator.prototype = {
initialize: function() {},
type: 'ImpersonateEvaluator',
canImpersonate: function(currentUser, impersonatedUser) {
if (currentUser.hasRole('Impersonate_user'))
return false;
else
return true;
}
};

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2023 03:47 AM
Hello @sunil kumar6
For your solution please refer to this community post:
- You can check for impersonation through the current session and use this in your ACLs/etc. to block those certain actions.
- For example, to return false as the answer in an ACL script when someone is using impersonation:
answer = !(GlideImpersonate().isImpersonating());
Here is a reference to read through: GlideImpersonateAPI