feat(system): add admin password reset with session revocation
Let system administrators reset another user's local password from the settings UI, revoke all active sessions, and record the action in the audit log.
This commit is contained in:
+272
-18
@@ -11148,31 +11148,21 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/system/admin/settings": {
|
||||
"/system/admin/runtime/queues": {
|
||||
"get": {
|
||||
"description": "Return every row in the system_settings table (system-scope,\nnot tenant-scope). SystemAdmin only.",
|
||||
"description": "返回各 asynq 队列的实时深度(pending/active/scheduled/retry 等)与 worker 并发配置,仅系统管理员可见",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"System Admin"
|
||||
"系统管理"
|
||||
],
|
||||
"summary": "List all system settings",
|
||||
"summary": "获取解析任务队列运行时状态",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "list of settings",
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.SystemSetting"
|
||||
}
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden: not a system admin",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
"$ref": "#/definitions/internal_handler.RuntimeQueuesResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11341,6 +11331,62 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/system/admin/users/reset-password": {
|
||||
"post": {
|
||||
"description": "Replace another user's local password and revoke all of their existing sessions (SystemAdmin only).\nA system administrator cannot reset their own password through this endpoint; self-service password change still requires the old password.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"System Admin"
|
||||
],
|
||||
"summary": "Reset another user's password",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Password reset request",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_handler.ResetUserPasswordRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Password reset successfully",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid request, weak password, or self reset",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden: not a system admin",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "User not found",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/system/docreader/reconnect": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
@@ -13737,6 +13783,7 @@ const docTemplate = `{
|
||||
2002,
|
||||
2003,
|
||||
2004,
|
||||
2005,
|
||||
2100,
|
||||
2101,
|
||||
2102,
|
||||
@@ -13761,6 +13808,7 @@ const docTemplate = `{
|
||||
"ErrTenantInactive",
|
||||
"ErrTenantNameRequired",
|
||||
"ErrTenantInvalidStatus",
|
||||
"ErrTenantCreationDisabled",
|
||||
"ErrAgentMissingThinkingModel",
|
||||
"ErrAgentMissingAllowedTools",
|
||||
"ErrAgentInvalidMaxIterations",
|
||||
@@ -13865,6 +13913,26 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"github_com_Tencent_WeKnora_internal_models_limiter.RuntimeStat": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"active": {
|
||||
"type": "integer"
|
||||
},
|
||||
"limit": {
|
||||
"type": "integer"
|
||||
},
|
||||
"model_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"waiting": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"github_com_Tencent_WeKnora_internal_types.APIPrincipalMode": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
@@ -13953,7 +14021,8 @@ const docTemplate = `{
|
||||
"opensearch.reindex_executed",
|
||||
"system.setting_changed",
|
||||
"system.admin_promoted",
|
||||
"system.admin_revoked"
|
||||
"system.admin_revoked",
|
||||
"system.user_password_reset"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"AuditActionMemberAdded",
|
||||
@@ -13974,7 +14043,8 @@ const docTemplate = `{
|
||||
"AuditActionOpenSearchReindexExecuted",
|
||||
"AuditActionSystemSettingChanged",
|
||||
"AuditActionSystemAdminPromoted",
|
||||
"AuditActionSystemAdminRevoked"
|
||||
"AuditActionSystemAdminRevoked",
|
||||
"AuditActionSystemUserPasswordReset"
|
||||
]
|
||||
},
|
||||
"github_com_Tencent_WeKnora_internal_types.AuditLog": {
|
||||
@@ -14123,6 +14193,10 @@ const docTemplate = `{
|
||||
"description": "Strategy selects the adaptive chunking tier. Empty / \"legacy\" preserves\nthe historical recursive splitter; \"auto\" lets a profiler pick between\nheading-aware, heuristic and recursive tiers; \"heading\" / \"heuristic\" /\n\"recursive\" pin the tier explicitly.",
|
||||
"type": "string"
|
||||
},
|
||||
"table_metadata_instructions": {
|
||||
"description": "TableMetadataInstructions contains optional business guidance used when\ngenerating searchable summaries for CSV/Excel tables. The system-owned\noutput contract remains fixed; these instructions only add domain context.",
|
||||
"type": "string"
|
||||
},
|
||||
"token_limit": {
|
||||
"description": "TokenLimit caps chunk size in approximate tokens. 0 = use ChunkSize\nas a character count.",
|
||||
"type": "integer"
|
||||
@@ -14629,6 +14703,10 @@ const docTemplate = `{
|
||||
"github_com_Tencent_WeKnora_internal_types.ExtractConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"custom_instructions": {
|
||||
"description": "CustomInstructions adds domain-specific extraction guidance while the\nsystem keeps ownership of the structured graph output protocol.",
|
||||
"type": "string"
|
||||
},
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@@ -16693,6 +16771,10 @@ const docTemplate = `{
|
||||
"github_com_Tencent_WeKnora_internal_types.QuestionGenerationConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"custom_instructions": {
|
||||
"description": "CustomInstructions describes the intended audience or question style.\nIt is appended to the stable system question-generation template.",
|
||||
"type": "string"
|
||||
},
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@@ -16702,6 +16784,63 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"github_com_Tencent_WeKnora_internal_types.QueueStat": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"active": {
|
||||
"type": "integer"
|
||||
},
|
||||
"archived": {
|
||||
"type": "integer"
|
||||
},
|
||||
"completed": {
|
||||
"type": "integer"
|
||||
},
|
||||
"failed": {
|
||||
"type": "integer"
|
||||
},
|
||||
"latency_ms": {
|
||||
"description": "LatencyMs is the age of the oldest pending task, in milliseconds.",
|
||||
"type": "integer"
|
||||
},
|
||||
"memory_usage_bytes": {
|
||||
"description": "MemoryUsageBytes is the approximate Redis memory the queue occupies.",
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"paused": {
|
||||
"description": "Paused reports whether the queue is paused (tasks not consumed).",
|
||||
"type": "boolean"
|
||||
},
|
||||
"pending": {
|
||||
"type": "integer"
|
||||
},
|
||||
"pool": {
|
||||
"description": "Pool is the independent worker pool that drains this queue.",
|
||||
"type": "string"
|
||||
},
|
||||
"processed": {
|
||||
"description": "Processed / Failed are today's counters (reset daily).",
|
||||
"type": "integer"
|
||||
},
|
||||
"retry": {
|
||||
"type": "integer"
|
||||
},
|
||||
"scheduled": {
|
||||
"type": "integer"
|
||||
},
|
||||
"size": {
|
||||
"description": "Size is the total number of tasks in the queue (pending + active +\nscheduled + retry + aggregating + archived).",
|
||||
"type": "integer"
|
||||
},
|
||||
"weight": {
|
||||
"description": "Weight is the queue's scheduling weight inside its pool.",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"github_com_Tencent_WeKnora_internal_types.RegisterRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -17943,6 +18082,14 @@ const docTemplate = `{
|
||||
"description": "Base URL",
|
||||
"type": "string"
|
||||
},
|
||||
"custom_instructions": {
|
||||
"description": "CustomInstructions adds KB-specific image interpretation guidance without\nreplacing the system-owned OCR and Markdown output contract.",
|
||||
"type": "string"
|
||||
},
|
||||
"description_language": {
|
||||
"description": "DescriptionLanguage controls the language used for generated image\ncaptions. Empty means follow the document/request language.",
|
||||
"type": "string"
|
||||
},
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@@ -18127,6 +18274,10 @@ const docTemplate = `{
|
||||
"github_com_Tencent_WeKnora_internal_types.WikiConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"content_instructions": {
|
||||
"description": "ContentInstructions controls tone, structure and emphasis for generated\nsummary/entity/index prose. Citation and merge rules remain system-owned.",
|
||||
"type": "string"
|
||||
},
|
||||
"extraction_granularity": {
|
||||
"description": "ExtractionGranularity controls how many candidate slugs Pass 0 extracts\nper document. Empty / unknown value is treated as WikiExtractionStandard.",
|
||||
"allOf": [
|
||||
@@ -18135,6 +18286,10 @@ const docTemplate = `{
|
||||
}
|
||||
]
|
||||
},
|
||||
"extraction_instructions": {
|
||||
"description": "ExtractionInstructions tells candidate extraction which domain concepts\nto emphasize without replacing the stable JSON/citation protocol.",
|
||||
"type": "string"
|
||||
},
|
||||
"ingest_batch_size": {
|
||||
"description": "IngestBatchSize controls how many pending ops a single batch claims and\nprocesses before scheduling a follow-up. 0 falls back to the hard-coded\ndefault (5). Larger batches amortize per-batch setup and let more docs\nshare the batch-internal Map/Reduce fan-out; smaller batches spread a\nKB's backlog across more concurrent batches (finer scheduling grain).",
|
||||
"type": "integer"
|
||||
@@ -19283,6 +19438,9 @@ const docTemplate = `{
|
||||
"description": "Strategy / TokenLimit / Languages use pointer types so the\nhandler can distinguish \"field absent in payload\" (no change)\nfrom \"field present with empty/zero value\" (clear / disable).\nWithout that distinction, users could set strategy=\"auto\" once\nbut never reset it back to legacy / unset.",
|
||||
"type": "string"
|
||||
},
|
||||
"tableMetadataInstructions": {
|
||||
"type": "string"
|
||||
},
|
||||
"tokenLimit": {
|
||||
"type": "integer"
|
||||
}
|
||||
@@ -19308,6 +19466,9 @@ const docTemplate = `{
|
||||
"description": "知识图谱配置",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"customInstructions": {
|
||||
"type": "string"
|
||||
},
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@@ -19338,6 +19499,9 @@ const docTemplate = `{
|
||||
"description": "问题生成配置",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"customInstructions": {
|
||||
"type": "string"
|
||||
},
|
||||
"enabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@@ -19659,6 +19823,21 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_handler.ResetUserPasswordRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"email",
|
||||
"new_password"
|
||||
],
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"new_password": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_handler.RevokeSystemAdminRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -19670,6 +19849,81 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_handler.RuntimeQueuesResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"available": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"model_limiter_available": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"models": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_models_limiter.RuntimeStat"
|
||||
}
|
||||
},
|
||||
"parse_concurrency": {
|
||||
"description": "compatibility alias for upstream_concurrency",
|
||||
"type": "integer"
|
||||
},
|
||||
"pools": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/internal_handler.RuntimeWorkerPool"
|
||||
}
|
||||
},
|
||||
"queues": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.QueueStat"
|
||||
}
|
||||
},
|
||||
"timestamp": {
|
||||
"type": "integer"
|
||||
},
|
||||
"upstream_concurrency": {
|
||||
"type": "integer"
|
||||
},
|
||||
"wiki_concurrency": {
|
||||
"description": "compatibility field",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_handler.RuntimeWorkerPool": {
|
||||
"description": "Return every row in the system_settings table (system-scope, not tenant-scope). SystemAdmin only.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"active": {
|
||||
"description": "live workers assigned to this pool",
|
||||
"type": "integer"
|
||||
},
|
||||
"cluster_capacity": {
|
||||
"description": "sum of live server concurrency",
|
||||
"type": "integer"
|
||||
},
|
||||
"concurrency": {
|
||||
"description": "configured per instance",
|
||||
"type": "integer"
|
||||
},
|
||||
"instances": {
|
||||
"description": "live asynq server heartbeats",
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"queue_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"utilization": {
|
||||
"description": "Active / ClusterCapacity",
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_handler.SearchMessagesRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
||||
Reference in New Issue
Block a user