The following objects are used in multiple endpoints within the Security API.
Response Body
| Element | Description | Type | Notes |
|---|---|---|---|
| [security_policy_name] | List of elements defined for the named security policy. | array | Examples of some common security policy names include security_clearance and organisational_clearance. |
| engine | The engine, or algorithm, to be used for the security policy. | string | None |
| contentTypes | List of content types or subtypes to which the security policy is automatically applied when a document of that type is created. | array | If the list is empty or null, the security policy is not automatically applied to any content type upon document creation. |
| permissions | List of permissions for which the security policy is relevant. | array | The list cannot be empty or null. To specify that the security policy is relevant to all permissions, the list can include the Everything permission. |
| mixin | The content model mixin to be used to associate relevant documents with the security policy engine. | string | None |
| userAttribute | The user attribute to be used to associate users with the security policy. | string | None |
| expression | Expression security policy rule to evaluate to determine if access to the document for the specified permissions is granted. | string | The policy rule evaluates the expression using a context that
contains the following objects:
For more information on how expression security policy rules are evaluated, see Expression Syntax. |
Sample Response
{
"security_clearance": {
"engine": "expression",
"contentTypes": ["Contract"],
"permissions": ["Read", "Write"],
"mixin": "Visibility",
"userAttribute": "defenseLevel",
"expression": "user.defenseLevel >= content.visibility_scope || user.groups.contains("auditor") || content.sys_creator == user.id"
}
}
Expression Syntax
Expression security policy rules are evaluated according to the syntax detailed in the following table:
| Policy Rule Element | Element Types | Examples or Notes |
|---|---|---|
| Operators | Arithmetic | +, -, *, / |
| Relational | <, >, <=, >= | |
| Boolean | &&, ||, ! | |
| Ternary | … ? … : ... | |
| String Concatenation | + | |
| Grouping | (…) | |
| Types | Boolean | true, false |
| Integer | 12345, -1000 | |
| Floating Point | 1234.5, 1E-10 | |
| String | test | |
| Names | User Properties |
|
| Content Properties |
content.sys_creator,
content.my_customproperty
Note: Content properties are restricted in their
usage, since they later need to be translated to HXQL and
evaluated by OpenSearch. This restriction means that any content
property must only appear on the left side of a comparison
operator, and the right side must not be another content
property (for example, content.my_customproperty =
'test' is valid, but
content.my_customproperty =
content.other_property is not).
|
|
| Functions | List Membership | The <list>.contains(v1, [, v2, ...]) expression tests list membership. This returns true if all the passed values are contained in the list. |
Bringing the expression syntax elements together, consider the following example:
- A user attribute (defenseLevel) is defined at the Content Innovation Cloud Identity Provider level.
- A mixin (Visibility) is used, and it contains a schema that defines an integer property (visibility_scope).
- The expression is user.defenseLevel >= content.visibility_scope || user.groups.contains("auditor") || content.sys_creator == user.id.
In this example, access is granted if the user's defense level is at least as high as what is required for the document (stored as the visibility scope), or if the user is an auditor.