feat(roles): enhance role management panel with user list and inline … - #130
Conversation
…editing Redesign the Emperor's Role Management panel from a single-user search-and-assign form into a full user management dashboard with browsable user list and inline role editing.
Add ability for Emperor to delete users from the role management panel: - New POST /api/roles/delete endpoint with PROMOTE_USER permission guard, blocks deleting self or other emperors, cascades user data cleanup - Trash button on each non-emperor row with confirmation dialog - Auto-navigate to previous page when deleting the last user on a page - i18n strings added for all 5 locales
|
🆕 Added: Delete User in Role Management The Emperor (site owner) can now permanently delete users directly from the Role Management panel.
Endpoint: POST /api/roles/delete { userId } → { success: true } / { error } (400/403/500). 🆕 新增功能:角色管理 - 删除用户 皇帝(站点所有者)现在可以直接在角色管理面板永久删除用户。
接口:POST /api/roles/delete,请求体 { userId } → 成功 { sur }(400/403/500)。 |
There was a problem hiding this comment.
已修改回来了。之前不小心给改了。
There was a problem hiding this comment.
删除用户功能,从 restful 语意上来说,应该放到 api/users 下面, 使用 http DELETE 方法实现删除,请修改
- favicon: 从 public/favicon.ico 移回 app/favicon.ico(next-on-pages 1.13.16 下生产验证 /favicon.ico 正常返回) - 删除用户: POST /api/roles/delete 改为 DELETE /api/users/[id],符合 RESTful 语义(资源 users + 标准 DELETE 方法)
优化 GET /api/roles/users 用户列表的排序: - 主排序:按角色等级 皇帝 → 公爵 → 骑士 → 平民(无角色用户排最后) - 次排序:用户名长度(短者优先) - 末排序:用户名字母序(大小写不敏感) - 查询由 db.query.users.findMany(relational)改为显式 select + leftJoin, 以支持基于角色名的 CASE 排序 Sort the user list returned by GET /api/roles/users: - Primary: by role rank Emperor -> Duke -> Knight -> Civilian (users without a role sort last) - Secondary: username length (shorter first) - Tertiary: username alphabetical order (case-insensitive) - Switch the query from db.query.users.findMany (relational) to an explicit select + leftJoin to enable CASE-based ordering on role name
新增提交
|

feat(roles): 增强角色管理面板 - 用户列表与内联角色编辑
增强角色管理面板
概述
将皇帝的角色管理面板从单用户搜索+分配的表单,重新设计为完整的用户管理仪表板,支持可浏览的用户列表和内联角色编辑。
改动内容
新增 API:GET /api/roles/users
page、pageSize、search查询参数重构 promote-panel.tsx
i18n 更新(5 种语言:en、zh-CN、zh-TW、ja、ko)
totalUsers、prevPage、nextPage、pageInfosearchPlaceholder,反映扩展后的搜索范围(用户Enhanced Role Management Panel
Summary
Redesigned the Emperor's Role Management panel from a single-user search-and-assign form into a full user management dashboard with a browsable user list and inline role editing.
Changes
New API: GET /api/roles/users
Redesigned promote-panel.tsx
i18n Updates (5 locales: en, zh-CN, zh-TW, ja, ko)