Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

ACL evaluation in script for roles, not current user

Svetozar2022
Tera Expert

Hi,

 

Use case end goal: Create a CSV file in format below to capture for each group access per table in the system. See format below.

Group Nametable1table2table3table4...
Group1CRDCRUDRRUD
Group2CRUDCRUDCRUDCRUD
Group3...RRRU-

 
For that I would need some way to evaluate ACLs for a role in code.
Available inputs: group, roles (for that group), table name to evaluate against.

Do you know any baseline script include I can use? All I see use current user which is not what I want.

Edit clarification:
new GlideRecord(tableName).canWrite() or .canRead() would work well but only for current user. Impersonating group users would be possible via script however not all groups have at least 1 user.

GlideSecurityManager.hasRightsTo also works for the current user only.

Should I just add one dummy user to the group if empty, use one if not empty, impersonate that user and check if they can access certain tables? What is your recommendation?

0 REPLIES 0