rbac-design

仓库创建 2026年7月6日最近提交 22 天前SkillHot 收录 22 天前
▸ 精选理由

覆盖角色×域矩阵与 N:N 建模,适合需要明确“谁能做什么”的项目。

这个 Skill 做什么

为系统设计基于角色且具细粒度权限的 RBAC 模型与审批流程。

把“谁能做什么”做成可落地的权限设计:把权限拆成原子动作(Permission),把角色(Role)和业务领域做成矩阵,用 N:N 的数据库模型建表,并在上线前加审批流程。适合做权限、用户角色、后台管理或任何需要精细访问控制的系统时用。特别之处是避免“纯角色”思路带来的例外和返工,让复杂权限场景有可审计的实现路径。

▸ 展开 SKILL.md 英文原文

Role-based access control design with roles + granular permissions — role × domain matrix, N:N database modeling and an approval process before implementation. Use whenever the project involves permissions, user roles, access control, admin panels or "who can do what" questions in the system.

开发编程角色设计权限模型审计通用
2
Stars
0
Forks
6
仓库内 Skill
+0
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/JoaoEquer/Oficina/main/skills/rbac-design/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/JoaoEquer/Oficina/main/skills/rbac-design/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# RBAC design

Badly designed RBAC is guaranteed rework. This is the process and the model that work.

## The model: roles + granular permissions (not pure roles)

Pure roles ("admin can do everything, editor can edit") break at the first real exception. The house model:

- **Permission** = atomic action on a domain (e.g. `task:create`, `document:approve`, `report:export`).
- **Role** = named set of permissions (N:N role ↔ permission).
- **User** receives roles (N:N user ↔ role), and the system resolves the effective permission set.

```prisma
model Role {
  id          String  @id @default(uuid())
  workspaceId String
  name        String
  permissions RolePermission[]
}

model Permission {
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有