Can you limit Impersonator to specific users/groups as the target?

robpickering
ServiceNow Employee
ServiceNow Employee

I had someone ask me the other day if we could grant the Impersonator role to an account, but limit the users that could be Impersonated.   I know the Impersonator role prevents the impersonation of an account with the 'admin' role.   So, there's a check being done somewhere.   Anyone know if we can hook that check and add to it?   So we could perform a query based on the user and limit the "target" to specific users/groups?

1 ACCEPTED SOLUTION

Dan_Berglin
Giga Expert

Hi,


This check is in the UI Page named "impersonate_dialog".



Kind regards,


Dan Berglin


View solution in original post

9 REPLIES 9

Dan_Berglin
Giga Expert

Hi,


This check is in the UI Page named "impersonate_dialog".



Kind regards,


Dan Berglin


Dan, thanks for that, I doubt I'd ever have found it.   Looks like you could do a query before the



if (to_imp == gs.getImpersonatingUserName())


  session.onlineUnimpersonate();


else if (to_imp != gs.getUser().getID())


  doImpersonate(to_imp);



And then just add an && condition to the else if...



Great stuff!   Thank you.


Will this work for Helsinki UI16 ? the impersonate enable/disable property will no longer work in Helsinki and a fix is available in Istanbul .I am looking to disable the impersonate option for admins in Helsinki UI 16


Hi,

can you share what customization you done?
I have a requirement to create a new role to impersonate just to customers (contacts) and not to internal users.