- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 06:28 PM
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;
}
}
};
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 07:27 PM
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
Apart from that no additional customizations are required.
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 07:27 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2022 01:43 PM
Hi Maik,
Thanks for pointing me in the right direction.
Richo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2023 05:27 AM
Hello Richo,
where you able to restrict it. if yes can you please paste it. i have similar query