Give a role access to scope
This endpoint gives a role the specified access level to a scope.
POST /openapi/v1/roles/{role_id}/capabilities
Capabilities can only be added to the roles that the user has access to. If the roles is assigned to a scope, capabilities must correspond to that scope or its children. Service provider roles (those not assigned to a scope) can add capabilities for any scope.
Parameters: The request URL contains the following parameters
Name |
Type |
Description |
---|---|---|
role_id |
string |
Uniquely identifies the role. |
The JSON request body contains the following parameters
Name |
Type |
Description |
---|---|---|
app_scope_id |
string |
ID of the scope to which access is provided. |
ability |
string |
Possible values are SCOPE_READ, SCOPE_WRITE, EXECUTE, ENFORCE, SCOPE_OWNER, DEVELOPER |
For more description of abilities, refer to Roles .
Response object:
Name |
Type |
Description |
---|---|---|
app_scope_id |
string |
ID of the scope to which access is provided. |
role_id |
string |
ID of the role. |
ability |
string |
Possible values are SCOPE_READ, SCOPE_WRITE, EXECUTE, ENFORCE, SCOPE_OWNER, DEVELOPER |
inherited |
boolean |
Sample python code
role_id = '<role-id>'
req_payload = {
'app_scope_id': '<app-scope-id>',
'ability': 'SCOPE_READ'
}
restclient.post('/roles/%s/capabilities' % role_id,
json_body=json.dumps(req_payload))