Files
TARE-Learn/slidev/pages/day4/m1-rbac-permission-model.md
T
2026-07-02 10:04:32 +08:00

78 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 模块 1:RBAC 权限模型设计
<div class="mt-6 text-sm">
工单模块不是普通 CRUD。不同角色看到的数据不同、能做的动作不同、承担的责任也不同。
</div>
<div class="grid grid-cols-5 gap-3 mt-8 text-sm">
<div class="p-3 rounded-xl bg-blue-500/10 border border-blue-500/30 text-center">管理员</div>
<div class="p-3 rounded-xl bg-emerald-500/10 border border-emerald-500/30 text-center">负责人</div>
<div class="p-3 rounded-xl bg-amber-500/10 border border-amber-500/30 text-center">研发</div>
<div class="p-3 rounded-xl bg-purple-500/10 border border-purple-500/30 text-center">测试</div>
<div class="p-3 rounded-xl bg-gray-500/10 border border-gray-500/30 text-center">只读用户</div>
</div>
<!--
第四天从权限矩阵开始。
工单模块看起来像 CRUD,但真实业务里管理员、负责人、研发、测试、只读用户的权限边界完全不同。
如果不先设计矩阵,AI 很容易按默认 CRUD 生成所有按钮。
-->
---
# RBAC 权限矩阵
<div class="mt-5 text-xs">
| 功能 | 管理员 | 负责人 | 研发 | 测试 | 只读 |
|---|---|---|---|---|---|
| 查看列表 | Y | Y | Y | Y | Y |
| 新增工单 | Y | Y | N | Y | N |
| 编辑工单 | Y | Y | 条件允许 | 条件允许 | N |
| 删除工单 | Y | N | N | N | N |
| 指派工单 | Y | Y | N | N | N |
| 提交验证 | Y | Y | Y | N | N |
| 关闭工单 | Y | Y | N | Y | N |
| 驳回工单 | Y | Y | N | Y | N |
| 查看审计 | Y | Y | 条件允许 | 条件允许 | N |
| 查看看板 | Y | Y | N | N | N |
</div>
<!--
这张矩阵是课堂产出,不是讲师单方面给答案。
AI 可以生成初稿,但最终必须由业务和团队确认。
条件允许要写清条件,比如只能编辑自己负责的工单。
-->
---
# 权限矩阵 Prompt
<div class="mt-5 text-sm">
```md
请基于 JeecgBoot 工单模块设计 RBAC 权限矩阵。
角色:
管理员、负责人、研发、测试、只读用户。
功能点:
查看列表、查看详情、新增、编辑、删除、指派、提交验证、关闭、驳回、查看审计记录、查看看板。
要求:
1. 区分允许、禁止、条件允许。
2. 条件允许必须说明条件。
3. 每个敏感操作给出验收方式。
4. 不要直接生成代码。
```
</div>
<!--
这里训练学员不要直接让 AI 改代码。
先生成矩阵,再确认业务边界,最后才进入权限控制方案。
-->