Role management
it is necessary to add to the different users roles and to give them an available permissions.
Working with roles and permissions via DCM API you have the following opportunities:
Get available permissions
Get available permission
Counterparty GUID
GET /api/v1/counterparty/{counterparty_guid}/rbac/permission HTTP/1.1
Host: [url_host]
Accept: */*
{
"permissions": [
"text"
]
}
Add permission to role
Add role permission
Counterparty GUID
permission_guid that you get as a response to endpoint Permissions titles/Get permissions
role name
POST /api/v1/counterparty/{counterparty_guid}/rbac/permission HTTP/1.1
Host: [url_host]
Content-Type: application/json
Accept: */*
Content-Length: 45
{
"permission_guid": "text",
"role_name": "text"
}
{}
Remove role permission
Remove role permission
Counterparty GUID
guid of permission that you need to remove from an employee
role's name
DELETE /api/v1/counterparty/{counterparty_guid}/rbac/permission HTTP/1.1
Host: [url_host]
Content-Type: application/json
Accept: */*
Content-Length: 45
{
"permission_guid": "text",
"role_name": "text"
}
{}
Get roles with permissions for table
Get roles with permissions for table
Counterparty GUID
GET /api/v1/counterparty/{counterparty_guid}/rbac/permission/table HTTP/1.1
Host: [url_host]
Accept: */*
{
"roles": [
"text"
],
"rows": [
{
"group_lang_key": "text",
"group_name": "text",
"permissions": [
{
"guid": "text",
"name": "text",
"name_lang_key": "text",
"roles": [
{
"allowed": true,
"name": "text"
}
],
"sort_number": 1
}
],
"sort_number": 1
}
]
}
Get roles list
Create role
Create Role
Counterparty GUID
role's name
POST /api/v1/counterparty/{counterparty_guid}/rbac/role HTTP/1.1
Host: [url_host]
Content-Type: application/json
Accept: */*
Content-Length: 20
{
"role_name": "text"
}
{}
Delete role
Delete Role
Counterparty GUID
the name of the role that need to remove
DELETE /api/v1/counterparty/{counterparty_guid}/rbac/role HTTP/1.1
Host: [url_host]
Content-Type: application/json
Accept: */*
Content-Length: 20
{
"role_name": "text"
}
{}
Good to know: You can't delete the role "Administrator".
Get scopes
Get users list
Get users list
Counterparty GUID
role name (string)
limit (int64)
page token (int64)
GET /api/v1/counterparty/{counterparty_guid}/rbac/user HTTP/1.1
Host: [url_host]
Accept: */*
[
{
"page_token": "text",
"users": [
{
"guid": "text",
"role_name": "text"
}
]
}
]
Add user to role
Add user to role
Counterparty GUID
role name for the user
id of the user you add role to
POST /api/v1/counterparty/{counterparty_guid}/rbac/user HTTP/1.1
Host: [url_host]
Content-Type: application/json
Accept: */*
Content-Length: 39
{
"role_name": "text",
"user_guid": "text"
}
{}
Remove user from role
Remove user from role
Counterparty GUID
role's name
a user you remove the role from
DELETE /api/v1/counterparty/{counterparty_guid}/rbac/user HTTP/1.1
Host: [url_host]
Content-Type: application/json
Accept: */*
Content-Length: 39
{
"role_name": "text",
"user_guid": "text"
}
{}
Get all available permission titles
To get the list of all available permissions for the roles you should use this endpoint.
Get permissions
permissions GUIDs (uuid)
keto kinds (string)
keto permissions (string)
scope names (string)
Offset
Limit
Ordering
GET /api/v1/permissions/keto HTTP/1.1
Host: [url_host]
Accept: */*
[
{
"created_at": "text",
"default_group_name": "text",
"default_name": "text",
"group_lang_key": "text",
"group_sort_number": 1,
"guid": "text",
"keto_kind": "branch",
"keto_permission_name": "text",
"keto_scope_name": "text",
"name_lang_key": "text",
"name_sort_number": 1,
"updated_at": "text"
}
]
Create permissions
create keto permissions
if group_lang_key not found in translation, use it as default
if name_lang_key not found in translation, use it as default
key for translation table, where find name of group for permissions
sorting order for group among all groups
if empty its generate random guid
the kind of keto looking for permissions
name of keto permission, for now it POST, GET, PUT etc; Its may be anything in future
the name of scope for permission, for now it endpoint group, ex: accounts, customers, payments; No longer than 64 characters
key for translation table, where find name of permission
sorting order for permission under the group
POST /api/v1/permissions/keto HTTP/1.1
Host: [url_host]
Content-Type: application/json
Accept: */*
Content-Length: 231
{
"default_group_name": "text",
"default_name": "text",
"group_lang_key": "text",
"group_sort_number": 1,
"guid": "text",
"keto_kind": "branch",
"keto_permission_name": "text",
"keto_scope_name": "text",
"name_lang_key": "text",
"name_sort_number": 1
}
{
"guid": "text"
}
Last updated