chore: archive rbac-refactor — spec merge, design doc annotation, move to archive

This commit is contained in:
2026-07-03 09:32:28 +08:00
parent bc671ac660
commit 5eb76e9776
9 changed files with 156 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
change: rbac-refactor
design-doc: docs/superpowers/specs/2026-07-02-rbac-refactor-design.md
base-ref: 78676a124a80542ff89c55cdd6a63af02ac21782
archived-with: 2026-07-03-rbac-refactor
---
# RBAC 鉴权重构 实施计划
@@ -25,6 +26,7 @@ base-ref: 78676a124a80542ff89c55cdd6a63af02ac21782
- 前端权限存储在 localStorage `permissions` key 中,注销时清除
- Users 表移除 `role`VARCHAR`allowedMenus`TEXT字段改为关联表
archived-with: 2026-07-03-rbac-refactor
---
## 文件结构
@@ -77,6 +79,7 @@ base-ref: 78676a124a80542ff89c55cdd6a63af02ac21782
| `frontend/src/pages/Login/index.tsx` | 登录成功存储 permissions 到 localStorage |
| `frontend/src/pages/Users/index.tsx` | 重构:角色列显示多角色 Tag编辑弹窗使用 Select multiple移除 allowedMenus 相关代码API 端点改为 /rbac/users |
archived-with: 2026-07-03-rbac-refactor
---
### Task 1: 数据库实体与种子数据
@@ -246,6 +249,7 @@ git add backend/src/entities/permission.entity.ts backend/src/entities/role.enti
git commit -m "feat(rbac): add Permission and Role entities, update User entity"
```
archived-with: 2026-07-03-rbac-refactor
---
### Task 2: RBAC 服务层 (RbacModule + RbacService)
@@ -544,6 +548,7 @@ git add backend/src/rbac/
git commit -m "feat(rbac): add RbacModule and RbacService with seed data and role CRUD"
```
archived-with: 2026-07-03-rbac-refactor
---
### Task 3: 权限守卫装饰器 (PermissionGuard + @Public + @RequirePermission)
@@ -745,6 +750,7 @@ git add backend/src/auth/decorators/ backend/src/auth/guards/permission.guard.ts
git commit -m "feat(rbac): add PermissionGuard, @Public and @RequirePermission decorators"
```
archived-with: 2026-07-03-rbac-refactor
---
### Task 4: 修改 Auth 模块JWT 变更 + 与 RbacModule 集成)
@@ -992,6 +998,7 @@ git add backend/src/auth/
git commit -m "feat(rbac): integrate RbacService into AuthService login, update JWT payload"
```
archived-with: 2026-07-03-rbac-refactor
---
### Task 5: RbacController角色 CRUD + 权限树 + 用户管理)
@@ -1314,6 +1321,7 @@ git add backend/src/rbac/
git commit -m "feat(rbac): add RbacController with role CRUD, permissions tree, and user management endpoints"
```
archived-with: 2026-07-03-rbac-refactor
---
### Task 6: AppModule 注册 RbacModule 和 PermissionGuard
@@ -1437,6 +1445,7 @@ git add backend/src/app.module.ts
git commit -m "feat(rbac): register RbacModule and PermissionGuard in AppModule"
```
archived-with: 2026-07-03-rbac-refactor
---
### Task 7: 现有接口批量加 @RequirePermission
@@ -1560,6 +1569,7 @@ git add backend/src/students/ backend/src/rooms/ backend/src/occupancies/ backen
git commit -m "feat(rbac): add @RequirePermission decorators to all business controllers"
```
archived-with: 2026-07-03-rbac-refactor
---
### Task 8: 前端权限基础设施
@@ -1732,6 +1742,7 @@ git add frontend/src/hooks/ frontend/src/components/PermissionButton.tsx fronten
git commit -m "feat(frontend): add usePermission hook, PermissionButton, PermissionRoute, and 403 handling"
```
archived-with: 2026-07-03-rbac-refactor
---
### Task 9: 前端角色管理和权限一览页面
@@ -2055,6 +2066,7 @@ git add frontend/src/pages/Roles/ frontend/src/pages/Permissions/
git commit -m "feat(frontend): add Roles management page and Permissions overview page"
```
archived-with: 2026-07-03-rbac-refactor
---
### Task 10: 前端路由、菜单和用户管理页面适配
@@ -2556,6 +2568,7 @@ git add frontend/src/App.tsx frontend/src/layouts/MainLayout.tsx frontend/src/pa
git commit -m "feat(frontend): adapt routes, menus, Users page, and business pages for RBAC"
```
archived-with: 2026-07-03-rbac-refactor
---
### Task 11: 验证与收尾
@@ -2681,6 +2694,7 @@ git add -A
git commit -m "chore(rbac): final verification and lint fixes"
```
archived-with: 2026-07-03-rbac-refactor
---
## 自检

View File

@@ -2,6 +2,8 @@
comet_change: rbac-refactor
role: technical-design
canonical_spec: openspec
archived-with: 2026-07-03-rbac-refactor
status: final
---
# RBAC 鉴权重构技术设计