02f2c6660b
1、记录项目权限一致性实施计划,明确前后端权限矩阵以接口权限为准。 2、列出快捷入口、参与者操作、路由权限和权限契约测试的实施任务。 3、记录物资设备详情页实施计划,覆盖路由、详情页和列表导航入口。 4、保留验证步骤与约束说明,便于后续按计划复查实现范围。
2.4 KiB
2.4 KiB
Project Permission Consistency Implementation Plan
For Claude: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
Goal: Make project-level backend permissions and frontend route/menu/action visibility consistent.
Architecture: Treat backend API_ENDPOINT_PERMISSIONS and effective /api-permissions/me matrix as the source of truth. Frontend route guards, menus, quick actions, page actions, and attachment controls should only project that matrix into visibility or disabled states.
Tech Stack: FastAPI, SQLAlchemy, pytest, Vue 3, Pinia, Vue Router, Element Plus, Vitest.
Task 1: Frontend Action Visibility
Files:
- Modify:
frontend/src/components/QuickActions.vue - Modify:
frontend/src/views/ia/SubjectManagement.vue - Modify:
frontend/src/utils/permission.ts - Test:
frontend/src/components/QuickActions.test.ts - Test:
frontend/src/views/ia/SubjectManagement.test.ts - Test:
frontend/src/utils/permission.test.ts
Steps:
- Write failing source-level tests that prove quick actions are filtered by
getProjectRoutePermission/hasProjectPermission. - Write failing source-level tests that prove subject create/delete actions are guarded by
subjects:createandsubjects:delete. - Add minimal permission checks in the affected components.
- Run the targeted Vitest files and confirm they pass.
Task 2: Permission Contract Coverage
Files:
- Modify:
frontend/src/utils/projectRoutePermissions.test.ts - Modify:
backend/tests/test_api_permissions.py
Steps:
- Add tests for route landing paths and project route mappings using backend operation key names already present in the frontend contract.
- Extend backend configuration tests so service-level checks are included where feasible, especially document and attachment permission mappings.
- Keep tests focused on permission contract shape, not business data setup.
- Run targeted backend pytest files.
Task 3: Verification
Files:
- No production files unless tests identify another mismatch.
Steps:
- Run targeted frontend tests.
- Run frontend type check if dependencies are available.
- Run targeted backend permission tests.
- Report exact commands and results.
Constraints
- Do not create branches.
- Do not commit.
- Do not revert unrelated dirty worktree changes.
- Keep changes narrow and avoid redesigning permission management.