Impersonator Role - limiting what users can be impersonated

Richo1
Tera Expert

Hello,

I would like to restrict certain users who have the impersonator role to a sub-set of users that they can impersonate. I believe that this is achievable using a business rule - before query.

 

I found the below on another post however I have been unable to get this functioning in a business rule so if anyone can point me in the right direction or any other suggestions?

Thanks.

 

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) 
var ImpersonateEvaluator = Class.create();

ImpersonateEvaluator.prototype = {

initialize: function() {},

      type: 'ImpersonateEvaluator',

canImpersonate: function(currentUser, impersonatedUser) {

var userImpersonated = impersonatedUser.getID();

if(userImpersonated == '4444444444444444444') // refers to the sys_id of impersonated user

{

return false;

}

else


{


return true;


}


}


};

1 ACCEPTED SOLUTION

Maik Skoddow
Tera Patron
Tera Patron

Hi

in the list of all Script Includes you will find one with the name "ImpersonateEvaluator"

Open this Script Include and modify the the function as per your requirement

find_real_file.png

Apart from that no additional customizations are required.

Maik

View solution in original post

3 REPLIES 3

Maik Skoddow
Tera Patron
Tera Patron

Hi

in the list of all Script Includes you will find one with the name "ImpersonateEvaluator"

Open this Script Include and modify the the function as per your requirement

find_real_file.png

Apart from that no additional customizations are required.

Maik

Hi Maik,

Thanks for pointing me in the right direction.

Richo

Hello Richo,

 

where you able to restrict it. if yes can you please paste it. i have similar query