角色权限、RequirePermission、/me permissions 与 migration 000015; Reviewer Approve → Closed。Next:ECR-013B Contract Definition。 Co-authored-by: Cursor <cursoragent@cursor.com>
30 lines
1.0 KiB
Markdown
30 lines
1.0 KiB
Markdown
# ENGINEERING_SPEC — ECR-013A Admin RBAC
|
||
|
||
权威设计:`docs/BACKEND_DESIGN/BD-2026-013A-admin-rbac.md`
|
||
产品:`.ai/product/feature-spec/ops-rbac.md`
|
||
**当前:Implemented · awaiting Reviewer。**
|
||
|
||
## Implement order(已执行)
|
||
|
||
1. Migration:`admin_roles` · `admin_role_permissions` · `admin_accounts.role_id` + 种子 `super_admin`
|
||
2. ERD / glossary 已有则对表
|
||
3. Repo + service:Role 读写;Account 加载 permissions
|
||
4. Middleware:`RequirePermission(code)` 挂到既有写路由 + 新 roles 路由
|
||
5. `GET /me` 扩展 permissions
|
||
6. OpenAPI `$ref`
|
||
7. admin-h5:`/me` 读权限,无权限隐藏 CTA(不做完整角色编辑 UI 也可先 API-only)
|
||
8. Integration:AC-F/S/O;Perf 抽样 AC-P-01
|
||
9. TEST_REPORT · CODE_REVIEW · TRACEABILITY
|
||
|
||
## Constraints
|
||
|
||
- 函数 ≤50 · 文件 ≤400
|
||
- Handler → Service → Repository
|
||
- 禁止改 DeviceAuth
|
||
- 禁止 UserStatus(013B)
|
||
- 不提交密钥
|
||
|
||
## Done when
|
||
|
||
ECR Acceptance + 四类 AC 映射绿 + `ess-validate --phase review` + boundary-rules 无回归
|