Перейти к содержимому

Изменить RoleBinding

PUT
/roles/bindings/{binding_id}

Авторизация

bearer
headerAuthorizationBearer <token>

Токен сервисного аккаунта. См. раздел «Аутентификация».

Параметры пути

binding_id*number

Тело запроса

application/json
body
subject_type*string
Значения"user""organization""group"
scope_type*string
Значения"system""template""group""statistics""organization""unit""entity""project"
subject_id*number
role_id*string
Значения"system.admin""organization.owner""organization.editor""organization.member""template.owner""unit.owner""unit.member""unit.viewer""template.editor""template.inspector""entity.owner""entity.editor""entity.viewer""project.owner""project.member""project.viewer"
scope_id*number
issuer_id?number

Тело ответа

responseapplication/json
organization_id*number
id*number
subject_type*string
Значения"user""organization""group"
subject_id*number | null
scope_type*string
Значения"system""template""group""statistics""organization""unit""entity""project"
scope_id*number | null

Возможные ошибки

400Bad Request

bad_request: Некорректный запрос

{  "statusCode": 400,  "error": "bad_request",  "message": "Некорректный запрос"}
401Unauthorized

unauthorized: Необходима авторизация

{  "statusCode": 401,  "error": "unauthorized",  "message": "Необходима авторизация"}
403Forbidden

access_denied: Недостаточно прав

{  "statusCode": 403,  "error": "access_denied",  "message": "Недостаточно прав"}
404Not Found

role_binding_not_found: Роль не найдена

{  "statusCode": 404,  "error": "role_binding_not_found",  "message": "Роль не найдена"}
409Conflict

last_organization_owner: У организации должен остаться хотя бы один владелец: сначала назначьте нового

{  "statusCode": 409,  "error": "last_organization_owner",  "message": "У организации должен остаться хотя бы один владелец: сначала назначьте нового"}
Пример запроса
curl -X PUT 'https://org.inspecto.in/api/roles/bindings/0' \  -H 'Content-Type: application/json' \  -d '{  "subject_type": "user",  "scope_type": "system",  "subject_id": 0,  "role_id": "system.admin",  "scope_id": 0}'
Пример ответа
{  "subject": {    "id": 0,    "email": "string",    "phone": "string",    "first_name": "string",    "last_name": "string",    "patronymic": "string",    "birthday": "2019-08-24T14:15:22Z",    "gender": 0,    "avatar": "string",    "created_at": "2019-08-24T14:15:22Z"  },  "scope": {    "id": 0,    "slug": "string",    "domain": "string",    "title": "string",    "avatar": "string"  },  "organization_id": 0,  "id": 0,  "role": {    "id": "system.admin",    "title": "string",    "description": "string",    "category": "string",    "scopes": [      "string"    ]  },  "subject_type": "user",  "subject_id": 0,  "scope_type": "system",  "scope_id": 0}