The CreatorCon Call for Content is officially open! Get started here.

How to limit users in impersonation

Community Alums
Not applicable

Hi Team, how can we limit the users to be selected in impersonation window? We have a requirement to allow only approved users to be available for impersonators to impersonate.

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Thank you @iamkalai, I have used below condition in before query BR on sys_user table, and it works.

Condition: gs.getSession().isInteractive()  && gs.action != ''

Script: if ((gs.action.getGlideURI().toString()).indexOf('impersonate') != -1 || (gs.action.getGlideURI().toString()).indexOf('angular.do?sysparm_type=ref_list_data') != -1) {

  <YOUR CODE GOES HERE>

}

 

NOTE: Do not add above if condition in the condition field, orelse you will get java null pointer exception while updating record in sys_user table.

View solution in original post

17 REPLIES 17

You will have to play around the condition and see if you can find the relevant condition. The best thing I would suggest you to edit ImpersonateEvaluator instead of going through all of this.

Community Alums
Not applicable

Thank you @iamkalai, I have used below condition in before query BR on sys_user table, and it works.

Condition: gs.getSession().isInteractive()  && gs.action != ''

Script: if ((gs.action.getGlideURI().toString()).indexOf('impersonate') != -1 || (gs.action.getGlideURI().toString()).indexOf('angular.do?sysparm_type=ref_list_data') != -1) {

  <YOUR CODE GOES HERE>

}

 

NOTE: Do not add above if condition in the condition field, orelse you will get java null pointer exception while updating record in sys_user table.

Tried it, works fine.

Thank you for sharing

I was curious if you could provide an example or two of the type of code that goes in <YOUR CODE GOES HERE> for me to use as a starting point? I would like to restrict to users to members of a specific group or who have been assigned a specific role.

Community Alums
Not applicable

That depends on your requirement, let me know the requirement.