Explicit Roles in CSM
You can give both internal users and external users access to your instance. However, you might not want both types of users to have the same level of access. To provide added security, every user must have at least one role so that the instance can distinguish between internal and external users.
As of the Paris release, no user can have both of the explicit roles (snc_internal and snc_external). Groups and role containment cannot include both roles, either, since that would cause any group member or user who is assigned to such a group or such a role to automatically have both roles. The ServiceNow AI Platform aborts any operation that would create such a scenario.
- Tables without the role that inherits the snc_external role or the public role.
- Non-record type resources, such as processors and UI pages without granting access to the snc_external role or a role that inherits the snc_external role.
- Platform Analytics dashboards.
Do not mark the snc_internal role as elevated. Otherwise, internal users cannot access the instance.
Recommended CSM roles for internal and external users
Customers (external users) using the Customer Service Management application should be assigned either the sn_customerservice.customer or the sn_customerservice.consumer role. Customer service agents (internal users) should be assigned either the sn_customerservice_agent or sn_customerservice_consumer_agent role. The system ensures that the same user is not assigned both a customer (external) and agent (internal) role.
Explicit Roles plugin
The Customer Service plugin (com.sn_customerservice) activates the Explicit Roles plugin (com.glide.explicit_roles), which adds the snc_external and snc_internal roles. When the plugin is activated:
- All users must have either the snc_internal role to access internal resources or the snc_external role to access external resources.
- All existing users are automatically assigned the snc_internal role. This role does not
change existing access levels or system behavior. Instead, it provides a category to
differentiate internal users from external users. All internal users maintain the same
level of access as before the plugin was activated.Tip:To prevent changing existing functionality for users, activating the Explicit Roles plugin assigns the snc_internal user role to all existing users in the instance. This includes any external users added before the Explicit Roles plugin was activated. After the Explicit Roles plugin is activated, do the following for all external users added before the Explicit Roles plugin was activated:
- Remove the snc_internal role.
- Add the snc_external role.
- Newly created users are automatically assigned the snc_internal role when they first
attempt to log in to the instance, unless they have been explicitly assigned the
snc_external role. You can add the snc_external role to a new user before they first log
in to the instance to provide external user rights. Important:Activate this plugin during a maintenance window or when few users are logged in. Users currently logged in when the plugin is activated will not be dynamically assigned the snc_internal role. Rather, users must log out and log back in to be assigned the snc_internal role. Once the plugin is activated, you can add or remove the snc_internal and snc_external roles at any time to change user rights.
- All existing ACLs that do not have a role requirement are automatically assigned the snc_internal role. Because both existing ACLs and roles are assigned the snc_internal role, existing access levels do not change.
- Newly created ACLs that do not have a role requirement are automatically assigned the snc_internal role. This role assignment does not apply to a newly created ACL with a role assigned.
- For all existing Processor [sys_processor] records or newly created Processor [sys_processor] records with Type=script, the snc_internal role is automatically added to the Roles field if the field is empty.
- To restrict access to UI pages to internal users, the plugin automatically assigns the snc_internal role to the * ACL with a Type of ui_page.
- To restrict access to processors to internal users, the plugin automatically assigns the snc_internal role to the * ACL with a Type of processor.
- External users must obtain, at minimum, the snc_external role to access the instance.
This role is automatically assigned to external Customer Service Portal contacts. If the
Customer Service Portal is not activated, this role must be manually granted to external
users'. Access to records is granted through ACLs.Note:You can use the
isPublic()function in scripts for Customer Service Portal to change the privacy setting for a single client-callable script include. For more detail, see Script includes. - Content Management
System site access is also affected. CMS is set up with Sites
(content_site), Pages (content_page), and other resources. Some of the sites may have the
Login page configured.
- If CMS sites do not have the Login page configured, the public role is automatically added to the Read Roles field on Pages (content_page) if the field is empty.
- If CMS sites have the Login page configured, the snc_internal role is automatically added to the Read Roles field on Pages (content_page) if the field is empty.
- Service Portal
site access is also affected.
The snc_internal role is not automatically added to sp_page, sp_widget or sp_instance records. If desired, you can give new records the role by assigning snc_internal as a default value in the Roles field for these records. For details on this process see Specify a default field value.
Do not move System update sets among instances with and without the Explicit Roles plugin enabled.
The glide.security.explicit_roles.internal_user_blacklist property
The Explicit Roles plugin assumes that all existing users in the sys_user table at the time the plugin is installed are internal customers. A fix script assigns the snc_internal role to all existing users and to any ACL that does not have a role.
The fix script may fail or may not finish in time for a user who has not been updated with the role and who attempts to access a resource. To bridge this potential gap, the Contextual Security Manager (CSM) auto-assigns the snc_internal role to any user who logs in and does not have an explicit role (either internal or external).
Additionally, CSM has a business rule process that assigns the snc_external role to a classification of their users. However, when importing large sets of CSM external customers, workflow is set to false, so business rules don't run. As those users attempt to access a resource, they do not have any explicit roles. The Contextual Security Manager assigns the snc_internal role through a scheduled job called On-Call Gaps Conflicts Report that runs every 7 days. When the Explicit Roles plugin is active, this job assigns the snc_internal role to the CSM external user, since the user does not have either the snc_internal or snc_external role.
To prevent inadvertently providing the snc_internal role to external users, the Explicit Roles plugin includes a glide.security.explicit_roles.internal_user_blacklist property to exclude user types from ever becoming snc_internal. If there are no users types in the glide.security.explicit_roles.internal_user_blacklist table, the Contextual Security Manager assigns all users the snc_internal role by default. If there are classnames in the blacklist table, and if the sys_user class type is in the blacklist table, CSM assigns the snc_external role. Otherwise, CSM assigns the default snc_internal role as usual.
For the Paris release, this property is enabled by default for zBoot instances and and disabled by default for upgrades.
Providing table access to external users
You can provide external users access to a table by adding a role to the table that inherits the snc_external role. For more information, see Provide external users access to a table.
The hasRoles() method
The hasRoles() method is still available, but is deprecated in the Geneva release. Use the
hasRole(role name) method instead.
hasRoles() method, note these changes:- This method automatically excludes the default snc_internal role when it checks for
roles. This means that if a user has only the snc_internal role, the
hasRoles()method still returns false. - If the user has the snc_external role, the method returns false because the instance considers external users to be without a role.
Mutual exclusion: snc_external versus snc_internal
- Assign user Abel Tuter the snc_internal role.
- Assign user Abel Tuter the snc_external role.
Result: Adding the snc_external role fails because Abel Tuter has the snc_internal role.
Example: Adding both explicit roles to a group (direct collision):
- Consider a group called Test Group that currently has no explicit roles assigned to the group.
- Add Abel Tuter to the Test Group.
- Add the snc_external role to Test Group.
Result: Adding the snc_external role fails because Abel Tuter already has the snc_internal role and can't have both roles.
- Assign user Abel Tuter the snc_internal role.
- Consider a group called Test Group that currently has no explicit roles assigned to the group.
- Add Abel Tuter to the Test Group.
- Add the snc_external role to the Test Group.
Result: Adding the snc_external role to the group fails because Abel Tuter would inherit the snc_external role through group membership. Both explicit roles would be assigned to the same user, which isn't allowed.
For other examples, see the following table:
| Role | Attempted action | Result |
|---|---|---|
| Direct collision | ||
| The user has the snc_internal role. | Add the snc_external role. | The action is aborted. |
| The user has the snc_external role. | Add the snc_internal role. | The action is aborted. |
| The user has no explicit role. | Add the snc_internal or snc_external role. | The role is added. |
| The user has both explicit roles (existing collision). | Add the user to a group with no roles. | The action is aborted. |
| A role not associated with any users contains the snc_internal role. | Add the snc_external role. | The action is aborted. |
| A role not associated with any users contains the snc_external role. | Add the snc_internal role. | The action is aborted. |
| A role contains both explicit roles (existing collision). | Add the role to a user, role, or group. | The action is aborted. |
| A group with no members has the snc_internal role. | Add the snc_external role. | The action is aborted. |
| A group with no members has the snc_external role. | Add the snc_internal role. | The action is aborted. |
| A group with no members has no roles. | Add the snc_internal or snc_external role. | The role is added. |
| Indirect collision | ||
| Role containment with collision |
|
The action is aborted. |
| Role containment without collision |
|
The role is added to both the user and Test Role. |
| Group containment with collision |
|
The action is aborted. |
| Group containment without collision |
|
The role is added to the parent group, the child group, and the user. |
| Group containment plus role containment with collision | Add contains_external to Test Group 1, the parent of Test Group 2. | Test Group 1 and Test Group 2 both get contains_external, but don't explicitly get the snc_external role. |
| Add the snc_internal role to Test Group 2, the child of Test Group 1. | The action is aborted. | |
| Group parent change plus group containment |
|
The action is aborted. Repeat for already nested groups, with the same expectation. |
The cause of an aborted action appears in the error message and must be addressed before another attempt succeeds.
For direct cases, such as adding an explicit role to an individual user, verify which explicit role the user should have. If the user has the wrong explicit role, it must first be removed, and then the correct explicit role must be added.
For indirect cases,such as adding an explicit role to a group (so that a group member would be assigned both explicit roles), evaluate whether that user should be in the group. Also determine whether the group should be given the explicit role, including any inheritance through group hierarchy and role containment.
Note that the ServiceNow AI Platform reports only the first potential collision encountered. If repeated attempts continue to fail after remediation, with a new root cause each time, re-evaluate the relevant user/group/role interdependence more broadly. You may want to rethink how groups and role containments are structured.