Управління ролями
Необхідно додати до різних користувачів ролі та надати їм необхідні дозволи.
Працюючи з ролями та дозволами через DCM API, є наступні методи та функції:
Отримати доступні дозволи
Get available permission
Counterparty GUID
GET /api/v1/counterparty/{counterparty_guid}/rbac/permission HTTP/1.1
Host: [url_host]
Accept: */*
{
"permissions": [
"text"
]
}
Додати певний дозвіл до ролі
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
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
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
}
]
}
Отримати список ролей
Створити роль
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
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"
}
{}
Звертаємо увагу: Ви не можете видалити роль «Адміністратора».
Отримати перелік сутностей для дозоволу
Наприклад, такі як:
Відділення;
Працівник;
Сутності;
Клієнти.
Отримати список користувачів
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
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
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 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 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