feat(api-keys): add platform-scoped API keys for control-plane automation
Introduce platform API keys with capability-based access to tenant management, system settings, runtime queues, and audit logs, plus admin UI for key lifecycle and system audit log viewing.
This commit is contained in:
+89
-2
@@ -294,6 +294,8 @@ definitions:
|
||||
- system.admin_promoted
|
||||
- system.admin_revoked
|
||||
- system.user_password_reset
|
||||
- system.api_key_created
|
||||
- system.api_key_revoked
|
||||
- system.queue_task_retried
|
||||
- system.queue_task_deleted
|
||||
- system.queue_task_run_now
|
||||
@@ -320,6 +322,8 @@ definitions:
|
||||
- AuditActionSystemAdminPromoted
|
||||
- AuditActionSystemAdminRevoked
|
||||
- AuditActionSystemUserPasswordReset
|
||||
- AuditActionSystemAPIKeyCreated
|
||||
- AuditActionSystemAPIKeyRevoked
|
||||
- AuditActionSystemQueueTaskRetried
|
||||
- AuditActionSystemQueueTaskDeleted
|
||||
- AuditActionSystemQueueTaskRunNow
|
||||
@@ -3060,6 +3064,13 @@ definitions:
|
||||
id:
|
||||
description: ID
|
||||
type: string
|
||||
im_platform:
|
||||
description: |-
|
||||
IMPlatform is the originating IM platform (e.g. "feishu", "wecom") when
|
||||
this session is bound to an IM channel. It is not stored on the sessions
|
||||
table (it lives in im_channel_sessions) and is populated on read so the
|
||||
Web console can classify a session's origin folder without a list query.
|
||||
type: string
|
||||
is_pinned:
|
||||
description: IsPinned indicates whether the session is pinned in the list.
|
||||
type: boolean
|
||||
@@ -5374,6 +5385,17 @@ definitions:
|
||||
tenant_name:
|
||||
type: string
|
||||
type: object
|
||||
internal_handler.platformAPIKeyCreateRequest:
|
||||
properties:
|
||||
capabilities:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
expires_at_unix:
|
||||
type: integer
|
||||
name:
|
||||
type: string
|
||||
type: object
|
||||
internal_handler.registerByInviteRequest:
|
||||
properties:
|
||||
email:
|
||||
@@ -12044,7 +12066,8 @@ paths:
|
||||
in: query
|
||||
name: keyword
|
||||
type: string
|
||||
- description: 来源过滤:web / feishu / wechat / slack / ...
|
||||
- description: 来源过滤:web / embed / api / feishu / wechat / slack / ...(api、embed、IM
|
||||
渠道需 Admin+)
|
||||
in: query
|
||||
name: source
|
||||
type: string
|
||||
@@ -12971,6 +12994,70 @@ paths:
|
||||
summary: List allowed storage provider types
|
||||
tags:
|
||||
- StorageBackend
|
||||
/system/admin/api-keys:
|
||||
get:
|
||||
description: Lists non-workspace API keys. Full tokens are always masked. Human
|
||||
SystemAdmin only.
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
security:
|
||||
- Bearer: []
|
||||
summary: List platform API keys
|
||||
tags:
|
||||
- System Admin
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Creates a capability-scoped key that may target any workspace through
|
||||
X-Tenant-ID. The plaintext token is returned once. Human SystemAdmin only.
|
||||
parameters:
|
||||
- description: Platform API key
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/internal_handler.platformAPIKeyCreateRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: Created
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
security:
|
||||
- Bearer: []
|
||||
summary: Create a platform API key
|
||||
tags:
|
||||
- System Admin
|
||||
/system/admin/api-keys/{key_id}:
|
||||
delete:
|
||||
description: Immediately revokes a platform API key. Human SystemAdmin only.
|
||||
parameters:
|
||||
- description: API key ID
|
||||
in: path
|
||||
name: key_id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
security:
|
||||
- Bearer: []
|
||||
summary: Revoke a platform API key
|
||||
tags:
|
||||
- System Admin
|
||||
/system/admin/audit-log:
|
||||
get:
|
||||
description: 返回 system-scope(tenant_id=0)的审计事件,覆盖 system.setting_changed / system.admin_promoted
|
||||
@@ -14827,7 +14914,7 @@ paths:
|
||||
- WeKnoraCloud
|
||||
securityDefinitions:
|
||||
ApiKeyAuth:
|
||||
description: 空间身份认证:输入 sk- 开头的 API Key
|
||||
description: API Key 认证:空间 Key 固定访问所属空间;平台 Key 调用空间接口时需同时传 X-Tenant-ID
|
||||
in: header
|
||||
name: X-API-Key
|
||||
type: apiKey
|
||||
|
||||
Reference in New Issue
Block a user