POST
/
api
/
auth
/
admin
/
roles
创建自定义角色
curl --request POST \
  --url https://wfapi.yuhe.space/api/auth/admin/roles \
  --header 'Content-Type: application/json' \
  --cookie workflow_auth_session= \
  --data '
{
  "name": "<string>",
  "permissions": [],
  "description": "<string>"
}
'
{
  "errCode": 123,
  "errMessage": "<string>",
  "data": {
    "role": {
      "id": "<string>",
      "name": "<string>",
      "description": "<string>",
      "builtin": true,
      "protected": true,
      "permissions": [],
      "createdAt": "2023-11-07T05:31:56Z",
      "updatedAt": "2023-11-07T05:31:56Z",
      "createdByUserId": "<string>"
    }
  }
}

Authorizations

workflow_auth_session
string
cookie
required

通过密码登录或管理员密钥登录建立的 httpOnly 浏览器会话。

Body

application/json
name
string
required
permissions
enum<string>[]
required
Available options:
system.admin,
users.read,
users.manage,
roles.read,
roles.manage,
api_keys.manage_self,
api_keys.manage_all,
projects.create,
projects.read_public,
projects.read_all,
projects.manage_own,
projects.manage_all,
projects.delete,
projects.upload,
projects.publish,
runs.create,
runs.read_own,
runs.read_project,
runs.cancel,
env.manage,
kv.read,
knowledge.manage,
embed.manage,
webhook.manage,
run_queue.manage,
terminal.use,
audit.read,
audit.export
description
string

Response

创建成功并返回角色详情。

errCode
integer
required
errMessage
string
required
Allowed value: ""
data
object
required