UsersНазначить роль пользователю

Назначить роль пользователю

Admin выставляет роль пользователя: admin (полный доступ к конфигу Vault'ов, реестрам, политикам) или user. Так назначается второй и последующие админы; первый создаётся scripts/create-admin.ts.

curl -X PATCH "https://policy-engine-rest.ezig.workers.dev/api/v1/users/example_string/role" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{
  "role": "admin"
}'
{
  "id": "example_string",
  "email": "user@example.com",
  "role": "example_string"
}
PATCH
/api/v1/users/{id}/role
PATCH
Base URLstring

Target server for requests. Edit to use your own host.

Bearer Token
Bearer Tokenstring
Required

better-auth session token. Мобилка/сервисы. Веб использует cookie.

better-auth session token. Мобилка/сервисы. Веб использует cookie.
API Key (cookie: better-auth.session_token)
path
idstring
Required

id пользователя (better-auth User.id)

Content-Typestring
Required

The media type of the request body

Options: application/json
rolestring
Required
Options: admin, user
Request Preview
Response

Response will appear here after sending the request

Authentication

header
Authorizationstring
Required

Bearer token. better-auth session token. Мобилка/сервисы. Веб использует cookie.

path
parameterstring
Required

API Key for authentication. Provide your API key in the cookie.

Path Parameters

idstring
Required

id пользователя (better-auth User.id)

Body

application/json
rolestring
Required
Allowed values:adminuser

Responses

idstring
Required
emailstring
Required
rolestring
Required