Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
var userId = ['abel.tuter', 'abraham.lincoln']; //example
var workItems = ['INC0009009', 'INC0009005'];
/* Beginning of function*/

var gi = GlideImpersonate();
var currUser = gs.getUserID();

// If the logged in user doesn't have impersonating roles.
if (!gi.canImpersonate(currUser)) {
gs.info("You don't have access to impersonate");
}
for (var id in userId) {
var userGr = new GlideRecord('sys_user');
userGr.addQuery('user_name', userId[id]);
userGr.query();
if (!userGr.hasNext()) {
// If the user id mentioned is incorrect
gs.print("Cannot find user from user id " + user[id] + ". Please Validate the user id");
} else if (userGr.active == 'false') {
//If the persona is inactive
gs.print(id + " is inactve.");
} else {
gi.impersonate(userGr.sys_id);
// Analysis report
gs.print("Access result for " + gs.getUserDisplayName + ":");
for (var item in workItems){
var taskGr = new GlideRecord('task');
taskGr.addQuery('number', workItems[item]);
taskGr.query();
gs.print(workItems[item] + " Read: " + taskGr.canRead() + ", Write: " + taskGr.canWrite());
}

}

}
// End impersonation. Impersonate back to logged in user
gi.impersonate(currUser);
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
In scenarios where it's necessary to verify Read/Write access for multiple users across various work items (such as Incidents, Tasks, etc.), traditional methods like impersonating individual users or using the Access Analyzer plugin can be time-consuming. This utility streamlines the process by enabling simultaneous access analysis for multiple users by impersonating them and can be executed efficiently via a background script.

userId- Array containing the user id of personas whose access to be analyzed.

workItems- Work items extending the 'task' table.
Loading