Access Control List API - ServiceNow Fluent
- UpdatedJan 30, 2025
- 6 minutes to read
- Washington DC
- ServiceNow SDK
The Access Control List API defines access control lists [sys_security_acl] that secure parts of an application.
For general information about access control lists (ACLs), see Access Control List Rules.
ACL object
Configure a custom ACL rule [sys_security_acl] to secure access to new objects or to change the default security behavior.
ACLs must include one or more roles, a security attribute, a condition, or a script.
| Name | Type | Description |
|---|---|---|
| $id | String or Number | Required. A unique ID for the metadata object. When you build the application, this ID is hashed into a unique sys_id. Format: |
| operation | String | Required. The operation that this ACL rule secures. An ACL rule can only secure one operation. To secure multiple operations, create a separate ACL rule for each. The operation must be Valid values:
|
| active | Boolean | Flag that indicates whether the ACL rule is enforced. Valid values:
Default: true |
| admin_overrides | Boolean | Flag that indicates whether users with the admin role automatically pass the permissions check for this ACL rule. Valid values:
Default: true |
| script | Script | A custom script that defines the permissions required to access the object. This property supports a function from a JavaScript module, a reference to another file in the application that contains a script, or inline JavaScript.
ACLs must include one or more roles, a security attribute, a condition, or a script. Note: If the type property is graphql, scripts aren't supported.The script can
use the values of the current and previous global variables and system properties. The script must generate a true or false response in one of two ways:
Note: If the evaluated item is in a related list, current points to the item the related list is on, not to the current item the ACL is for. However, If the item you are
evaluating the ACL for is not in a related list, current points to the actual item.Format:
|
| description | String | A description of the object or permissions this ACL rule secures. |
| local_or_existing | String | The type of security attribute to apply. Valid values:
Default: Local |
| decision_type | String | An option for whether the ACL should allow or deny access. Valid values:
Default: allow |
| condition | String | A filter query that specifies the fields and values that must be true for users to access the object. For more information, see Operators available for filters and queries. ACLs must include one or more roles, a security attribute, a condition, or a script. |
| roles | Array | A list of variable identifiers of Role objects or sys_ids of roles that a user must have to access the object. For more information, see Role API - ServiceNow Fluent. ACLs must include one or more roles, a security attribute, a condition, or a script. Note: Users with the admin role always pass this permissions check because the admin role automatically grants users all other roles. |
| security_attribute | String | Pre-defined conditions for the ACL to use. For example, whether a user is impersonating another user. For more information about security attributes, see OOB(Out-of-Box) Security Attributes. ACLs must include one or more roles, a security attribute, a condition, or a script. Note: For security attributes with the Is localized
field set to true, the local_or_existing property of the ACL should be set to Local. If the Is localized field is false, the local_or_existing property
should be set to Existing. Valid values:
|
| table | String | The name of the table to which the ACL applies. This property only applies and is required if the type property is one of the following values: ux_data_broker, ux_page, ux_route, pd_action, or record. |
| field | String | The name of a field on the table to secure. You can use the wildcard character ("*") to select all fields. |
| type | String | The type of object that this ACL rule secures. The type determines which operations are available. After creating an ACL rule, if you want to change the type, you must delete the ACL and create a new one with the correct type. Valid values:
Default: record |
| name | String | The name of the ACL. This property only applies and is required if the type property is one of the following values: rest_endpoint, ui_page, processor, graphql, client_callable_flow_object, or client_callable_script_include. |
| $meta | Object | Metadata for the application metadata. With the installMethod property, you can map the application metadata to an output directory that loads only in specific
circumstances. Valid values for installMethod:
|
Example
import { Acl } from "@servicenow/sdk/core";
export default Acl({
$id: Now.ID['task_delete_acl'],
active: true,
admin_overrides: true,
type: 'record',
table: 'task',
field: 'description',
operation: 'delete',
roles: [adminRole, managerRole],
})
import { Role } from "@servicenow/sdk/core";
const managerRole = Role({
$id: Now.ID['manager_role'],
name: 'x_snc_example.manager'
})
const adminRole = Role({
$id: Now.ID['admin_role'],
name: 'x_snc_example.admin',
contains_roles: [managerRole]
})Related Content
- ServiceNow Fluent
Define application metadata in source code using the ServiceNow Fluent domain-specific programming language.