feat(system-admin): implement bootstrap for system admin promotion and enhance system settings management

- Added WEKNORA_BOOTSTRAP_SYSTEM_ADMIN_EMAIL environment variable to promote a specified user to system admin on startup.
- Introduced a new bootstrap process in `bootstrap.go` to handle the promotion logic.
- Updated `.env.example` to document the new environment variable and its behavior.
- Created new views for managing system administrators and system settings, including listing, promoting, and revoking admin privileges.
- Enhanced the frontend to reflect the new system admin features, including UI elements for admin management and settings configuration.
- Updated API interfaces to support system admin functionalities, ensuring proper data handling and user management.
This commit is contained in:
wizardchen
2026-05-24 21:38:05 +08:00
committed by lyingbug
parent e6ee87759d
commit 47a183aa65
43 changed files with 3322 additions and 146 deletions
+11
View File
@@ -430,6 +430,10 @@ COS_ENABLE_OLD_DOMAIN=true
# ========== 文件上传大小限制 ==========
# 统一的文件大小限制(MB),默认为50MB
# 影响:单文件上传、gRPC消息大小、Nginx请求体大小
#
# 优先级(自 P1 起):DB 中的 system_settings.file.max_size_mb > 此环境变量 > 默认 50
# SystemAdmin 可以在「系统管理 → 全局设置」面板里实时调整该值,无需重启服务。
# 此处的环境变量仍然作为回退(DB 没有 row 时使用)。
# MAX_FILE_SIZE_MB=50
# ========== Agent Skills Sandbox 配置 ==========
@@ -460,6 +464,13 @@ WEKNORA_SANDBOX_TIMEOUT=60
# 注意:开发环境用 Air 热重载时,修改本变量需重启 dev 脚本(仅源代码变更才重读 .env)。
# WEKNORA_TENANT_ENABLE_RBAC=true
# 启动时自动把指定 email 的用户提升为系统管理员(SystemAdmin)。
# - 该用户必须已经注册过;如果尚未注册,启动只会 warn 一行,下次重启会重试
# - 操作幂等:已是系统管理员的用户重复 bootstrap 是 no-op
# - 仅 PROMOTE,从不 DEMOTE:在 UI 上手动撤销后,下次重启不会被覆盖
# - 适用于 docker-compose / k8s 部署的初次自举;后续的提权/撤销请走 SystemAdmin 管理页
# WEKNORA_BOOTSTRAP_SYSTEM_ADMIN_EMAIL=
# 单个非超管用户可自助创建(成为 Owner)的租户数上限。
# 仅统计 Owner 角色——被邀请为 Admin/Editor/Viewer 的不计入。
# 拥有 CanAccessAllTenants 的超管不受此限制。