chore: check off all remaining plan and tasks.md items
This commit is contained in:
@@ -2048,7 +2048,7 @@ cd frontend && npx tsc -b --noEmit
|
||||
|
||||
预期:无新增类型错误。
|
||||
|
||||
- [ ] **Step 4: Commit**
|
||||
- [x] **Step 4: Commit**
|
||||
|
||||
```bash
|
||||
git add frontend/src/pages/Roles/ frontend/src/pages/Permissions/
|
||||
@@ -2137,7 +2137,7 @@ const App: React.FC = () => {
|
||||
export default App;
|
||||
```
|
||||
|
||||
- [ ] **Step 2: 修改 MainLayout 菜单过滤**
|
||||
- [x] **Step 2: 修改 MainLayout 菜单过滤**
|
||||
|
||||
```tsx
|
||||
// frontend/src/layouts/MainLayout.tsx
|
||||
@@ -2302,7 +2302,7 @@ const MainLayout: React.FC = () => {
|
||||
export default MainLayout;
|
||||
```
|
||||
|
||||
- [ ] **Step 3: 重构用户管理页面**
|
||||
- [x] **Step 3: 重构用户管理页面**
|
||||
|
||||
在 `frontend/src/pages/Users/index.tsx` 中:
|
||||
1. API 端点从 `/auth/users` 改为 `/rbac/users`,创建用户从 `/auth/register` 改为 `/rbac/users POST`
|
||||
@@ -2491,7 +2491,7 @@ const UsersPage: React.FC = () => {
|
||||
export default UsersPage;
|
||||
```
|
||||
|
||||
- [ ] **Step 4: 各业务页面关键按钮添加 PermissionButton 包装**
|
||||
- [x] **Step 4: 各业务页面关键按钮添加 PermissionButton 包装**
|
||||
|
||||
为以下页面的操作按钮添加 `PermissionButton` 包装:
|
||||
|
||||
@@ -2535,7 +2535,7 @@ import PermissionButton from '../../components/PermissionButton';
|
||||
</PermissionButton>
|
||||
```
|
||||
|
||||
- [ ] **Step 5: 编译和启动验证**
|
||||
- [x] **Step 5: 编译和启动验证**
|
||||
|
||||
```bash
|
||||
cd frontend && npx tsc -b --noEmit
|
||||
@@ -2549,7 +2549,7 @@ cd frontend && npm run dev
|
||||
|
||||
预期:前端正常启动,菜单按权限过滤,无权限页面显示 403。
|
||||
|
||||
- [ ] **Step 6: Commit**
|
||||
- [x] **Step 6: Commit**
|
||||
|
||||
```bash
|
||||
git add frontend/src/App.tsx frontend/src/layouts/MainLayout.tsx frontend/src/pages/Users/ frontend/src/pages/Students/ frontend/src/pages/Rooms/ frontend/src/pages/Occupancies/ frontend/src/pages/Expenses/ frontend/src/pages/Deposits/ frontend/src/pages/Bills/ frontend/src/pages/Classrooms/ frontend/src/pages/Tenants/ frontend/src/pages/ClassroomRentals/
|
||||
@@ -2565,7 +2565,7 @@ git commit -m "feat(frontend): adapt routes, menus, Users page, and business pag
|
||||
|
||||
**任务**:端到端验证 RBAC 系统正确运行。
|
||||
|
||||
- [ ] **Step 1: 启动后端验证种子数据**
|
||||
- [x] **Step 1: 启动后端验证种子数据**
|
||||
|
||||
```bash
|
||||
cd backend && npm run start:dev
|
||||
@@ -2577,7 +2577,7 @@ cd backend && npm run start:dev
|
||||
种子数据初始化完成: 42 权限点, 4 角色
|
||||
```
|
||||
|
||||
- [ ] **Step 2: 验证登录流程**
|
||||
- [x] **Step 2: 验证登录流程**
|
||||
|
||||
```bash
|
||||
# 测试登录(admin/admin123)
|
||||
@@ -2591,7 +2591,7 @@ curl -s -X POST http://localhost:3002/api/auth/login \
|
||||
- `user.permissions` 数组包含 42 个权限码
|
||||
- `user.roles` 数组包含 `["超管"]`
|
||||
|
||||
- [ ] **Step 3: 验证超管全通链路**
|
||||
- [x] **Step 3: 验证超管全通链路**
|
||||
|
||||
用步骤 2 获取的 token:
|
||||
```bash
|
||||
@@ -2606,7 +2606,7 @@ curl -s -H "Authorization: Bearer $TOKEN" http://localhost:3002/api/rbac/roles |
|
||||
|
||||
预期:两个接口均返回 200 且包含数据。
|
||||
|
||||
- [ ] **Step 4: 验证无权限拦截**
|
||||
- [x] **Step 4: 验证无权限拦截**
|
||||
|
||||
```bash
|
||||
# 不带 token 访问受保护接口
|
||||
@@ -2622,7 +2622,7 @@ curl -s -H "Authorization: Bearer invalidtoken" http://localhost:3002/api/studen
|
||||
|
||||
预期:返回 401。
|
||||
|
||||
- [ ] **Step 5: 验证宿管老师受限链路**
|
||||
- [x] **Step 5: 验证宿管老师受限链路**
|
||||
|
||||
创建宿管老师角色用户,验证其只能访问学生模块而不能访问角色管理:
|
||||
|
||||
@@ -2648,7 +2648,7 @@ curl -s -H "Authorization: Bearer $TEST_TOKEN" http://localhost:3002/api/rbac/ro
|
||||
|
||||
预期:students OK + roles BLOCKED。
|
||||
|
||||
- [ ] **Step 6: 验证前端**
|
||||
- [x] **Step 6: 验证前端**
|
||||
|
||||
```bash
|
||||
cd frontend && npm run dev
|
||||
@@ -2664,7 +2664,7 @@ cd frontend && npm run dev
|
||||
- 学生页面的新增/导入按钮可见
|
||||
- 直接访问 `/roles` URL 显示 403 页面
|
||||
|
||||
- [ ] **Step 7: 后端 lint 通过**
|
||||
- [x] **Step 7: 后端 lint 通过**
|
||||
|
||||
```bash
|
||||
cd backend && npm run lint
|
||||
@@ -2672,7 +2672,7 @@ cd backend && npm run lint
|
||||
|
||||
预期:无 lint 错误。如有格式问题,运行 `npm run format` 修复。
|
||||
|
||||
- [ ] **Step 8: 提交验证结果**
|
||||
- [x] **Step 8: 提交验证结果**
|
||||
|
||||
在验证全部通过后提交所有变更:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user