To expand your Read ACL on the RITM table so that members of the associated Catalog Task (sc_task) Assignment Groups can also view the RITM, you need to enhance the ACL script with logic that checks if the logged-in user is a member of any assignment group on related Catalog Tasks.
Given:
Important notes:
- No query Business Rule allowed — so we must do this inside the ACL script.
- We'll use GlideRecord queries inside the ACL script, but must be optimized and careful.
- ACL script must return
true to allow access, false to deny.
Sample Script ACL (Condition: None, Script: True)
(function() {
var userID = gs.getUserID();
// 1. Check ITIL role OR dynamic conditions already handled in ACL role condition or Data condition
// Here, assume they are not included in script (or handle if only script is used)
// 2. Check if user is the Assigned to on RITM
if (current.assigned_to && current.assigned_to == userID) {
return true;
}
// 3. Check if user is in the RITM assignment group
if (current.assignment_group) {
var am = new GlideUserMembership();
if (am.isMemberOfGroup(userID, current.assignment_group)) {
return true;
}
}
// 4. Now check if user is member of ANY Catalog Task's Assignment Group linked to this RITM
// Catalog Tasks are linked to RITM by request_item (field request_item on sc_task)
var taskGR = new GlideRecord('sc_task');
taskGR.addQuery('request_item', current.sys_id);
taskGR.query();
while (taskGR.next()) {
var taskAssignmentGroup = taskGR.assignment_group;
if (taskAssignmentGroup) {
var gm = new GlideUserMembership();
if (gm.isMemberOfGroup(userID, taskAssignmentGroup)) {
return true;
}
}
}
// If none of the above, deny access
return false;
})();
Explanation:
- You get the current user's sys_id.
- Check if user is assigned to the RITM.
- Check if user is member of RITM Assignment Group.
- Query all Catalog Tasks (
sc_task) related to this RITM (request_item = current.sys_id).
- For each task, if it has an assignment group, check if user is a member.
- If any condition matches, return
true to grant access.
- Else, return
false.
Performance considerations:
- Since ACL scripts run on every record accessed, the query can be expensive if there are many tasks.
- Consider limiting catalog tasks query if possible.
- Add caching or alternative strategies if performance becomes an issue.
If you already have some logic in the ACL Data condition for Assignment Group or Assigned to, you can simplify the script only to check the Catalog Task assignment group membership part.
In summary: Enhance your ACL script with a GlideRecord query on sc_task related to the RITM, check assignment groups membership for those tasks, and return true if user matches any. This respects your requirement of not using a Business Rule and doing all logic inside the ACL script.