docs: dev status round 17 — P2.1 permission registration
This commit is contained in:
@@ -560,6 +560,43 @@
|
|||||||
- 或 P4.1 通用依赖检查 helper 抽取(milestone start 和 task pending→open 复用)
|
- 或 P4.1 通用依赖检查 helper 抽取(milestone start 和 task pending→open 复用)
|
||||||
- 或 P5.4 补全后端 undergoing→completed 强制 comment 校验(前端已有弹窗,后端尚缺校验)
|
- 或 P5.4 补全后端 undergoing→completed 强制 comment 校验(前端已有弹窗,后端尚缺校验)
|
||||||
|
|
||||||
|
### 2026-03-17 15:00 UTC(第 17 轮:P2.1 权限枚举注册 + 全动作接口权限接入)
|
||||||
|
|
||||||
|
本轮做了什么:
|
||||||
|
- 实现 P2.1:在 `DEFAULT_PERMISSIONS` 注册 9 个新权限,并将所有动作接口从占位 `check_project_role` 切换为真正的 `check_permission`
|
||||||
|
- **新增权限**(init_wizard.py):
|
||||||
|
- `milestone.freeze` / `milestone.start` / `milestone.close`(category: milestone)
|
||||||
|
- `task.close` / `task.reopen_closed` / `task.reopen_completed`(category: task)
|
||||||
|
- `propose.accept` / `propose.reject` / `propose.reopen`(category: propose)
|
||||||
|
- **milestone_actions.py**:将旧字符串 `"freeze milestone"` 等替换为点分权限名 `"milestone.freeze"` 等
|
||||||
|
- **proposes.py**:accept/reject/reopen 三个端点从 `check_project_role(min_role="mgr")` 替换为 `check_permission(..., "propose.accept/reject/reopen")`,移除所有 TODO 占位注释
|
||||||
|
- **tasks.py**:transition 接口新增:
|
||||||
|
- `new_status == "closed"` 时调用 `check_permission(..., "task.close")`
|
||||||
|
- reopen 时根据来源区分 `task.reopen_completed` / `task.reopen_closed`
|
||||||
|
- admin 角色通过 `init_admin_role()` 自动获得所有新权限(无需手动配置)
|
||||||
|
|
||||||
|
改了哪些关键文件:
|
||||||
|
- `HarborForge.Backend/app/init_wizard.py` — 新增 9 个权限定义
|
||||||
|
- `HarborForge.Backend/app/api/routers/milestone_actions.py` — 权限名标准化
|
||||||
|
- `HarborForge.Backend/app/api/routers/proposes.py` — 替换为 check_permission
|
||||||
|
- `HarborForge.Backend/app/api/routers/tasks.py` — 新增 close/reopen 权限检查
|
||||||
|
|
||||||
|
验证结果:
|
||||||
|
- 4 个文件 Python AST 语法检查全部通过
|
||||||
|
- grep 确认无残留旧权限字符串和 TODO 占位
|
||||||
|
- 已 commit:backend `3afbbc2`,parent `054cf43`
|
||||||
|
|
||||||
|
当前阻塞/风险:
|
||||||
|
- P2.2 默认角色权限种子尚未细化(当前只有 admin 全量、guest 只读,dev/mgr 等自定义角色需要手动配置新权限)
|
||||||
|
- 前端按钮尚未根据用户权限做可见性控制(当前所有按钮对所有项目成员可见)
|
||||||
|
- batch transition 接口尚未同步权限检查
|
||||||
|
- 无本地 MySQL/运行环境做集成验证
|
||||||
|
|
||||||
|
下一轮最建议继续做什么:
|
||||||
|
- P4.1 通用依赖检查 helper 抽取(milestone start 和 task pending→open 复用),减少重复逻辑
|
||||||
|
- 或 P2.2 默认角色权限种子配置(为 dev/mgr 等常用角色预置合理的新权限组合)
|
||||||
|
- 或 P7.1 移除 `task_type = task`(代码清理项,独立性强)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 1. 背景
|
## 1. 背景
|
||||||
|
|||||||
Reference in New Issue
Block a user