Syntax of Fine-Grained Policies
Policy Structure
A policy consists of a Version and a Statement. Each policy can have multiple statements.
Policy Syntax
The RES Viewer policy is used as an example to describe the syntax of fine-grained policies.
- Version: Distinguishes between role-based access control (RBAC) and fine-grained policies.
- 1.0: RBAC policies: an RBAC policy consists of permissions for an entire service. Users in a group with such a policy assigned are granted all of the permissions required for that service.
- 1.1: Fine-grained policies: a fine-grained policy consists of API-based permissions for operations on specific resource types. Fine-grained policies, as the name suggests, allow for more fine-grained control than RBAC policies. Users granted permissions of such a policy can only perform specific operations on the corresponding service. Fine-grained policies include system and custom policies.
- Statement: Permissions defined by a policy, including Effect and Action.
- Effect
The valid values for Effect are Allow and Deny. System policies contain only Allow statements. For custom policies containing both Allow and Deny statements, the Deny statements take precedence.
- Action
Permissions in the format of Service name:Resource type:Operation. A policy can contain one or more permissions. The wildcard (*) is allowed to indicate all of the services, resource types, or operations depending on its location in the action.
Example:
res:*:get*: Permissions for querying all types of resources in RES.
For details about actions supported by RES, see "Permissions Policies and Supported Actions" in the RES API Reference.
- Effect
Deny Policy
A deny policy must be used in conjunction with other policies to take effect. If the permissions assigned to a user contain both Allow and Deny actions, the Deny actions take precedence over the Allow actions.
If you need to grant a user the RES Administrator policy but forbids the user to delete training jobs, create a custom policy for denying offline job deletion, and grant both policies to the user. Then the user can perform all operations on RES except deleting jobs. The following is a policy for denying offline job deletion.
{
"Version": "1.1",
"Statement": [
{
"Effect": "Allow",
"Action": [
"res:job:delete"
]
},
{
"Effect": "Deny",
"Action": [
"res:job:submit"
]
}
]
} Last Article: Basic Concepts
Next Article: Creating a Workspace
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.