- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 08-26-2015 09:48 AM
Hi,
Recently we had to solve a situation where certain users weren't supposed to see columns in lists based on their company.
Problem: ServiceNow add_to_list ACL operation does not support ACL scripts.
Reason: Security checks initiated in ListMechanic Script Include bypass ACL script(only roles requirements are checked).
Solution:
- Disable UI Policy hiding the script field in ACL. Name of UI Policy is "Hide Condition and Script for add_to_list ACL".
- Modify ListMechanic Script Include method applyRules:
applyRules: function(cls, tableName) {
var avail = cls.getColumns();
var sm = GlideSecurityManager.get();
var grs = new GlideRecordSecure(tableName);
grs.query();
grs.next();
for (var i = 0; i < avail.getSize();) {
var c = avail.getChoice(i);
var name = c.getValue();
var url = "record/" + tableName + '.' + name + "/add_to_list";
//var canAdd = sm.hasRightsTo(url, null);
var canAdd = sm.hasRightsTo(url, grs);
if (canAdd){
i++;
continue;
}
avail.remove(i);
}
},
Aknowledgements:
- Maybe there's a better way to initialize the GlideRecordSecure object without actually having to perform query.
- I don't know how these modifications will affect our next upgrade.
Cheers,
Stas