Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ KIRAKIRA RBAC & 权限控制 #27

Draft
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

cfdxkk
Copy link
Member

@cfdxkk cfdxkk commented Feb 8, 2025

开发并交付 KIRAKIRA RBAC 与权限控制功能。

KIRAKIRA RBAC 原子化权限控制的最小单位是 API 路径。

 * 一个用户可以拥有多个角色
 * 一个角色可以对应多位用户
 * 一个角色可以拥有对多个 API 的访问权限
 * 一个 API 可以对应多个角色

以下接口已经接入 RBAC

role: user

/video/danmaku/emit

/user/update/info

/video/comment/emit

role: administrator

/user/blocked/info
/user/adminGetUserInfo
/user/approveUserInfo
/user/adminClearUserInfo

/video/comment/adminDeleteComment

/video/upload
/video/tus
/video/delete
/video/pending
/video/pending/approved

/video/tag/create

role: root

/rbac/createRbacApiPath
/rbac/deleteRbacApiPath
/rbac/getRbacApiPath
/rbac/createRbacRole
/rbac/deleteRbacRole
/rbac/getRbacRole
/rbac/updateApiPathPermissionsForRole
/rbac/adminGetUserRolesByUid
/rbac/adminUpdateUserRole

啊啊啊,

1. 隐藏了旧的通过 role string 判断方式的鉴权接口,现在该接口对 admin 和 blocked 的 role 判定都会返回 fales,其他返回 true。稍后会将其他所有需要鉴权的接口改为 RBAC 鉴权。
2. 新增 RBAC 鉴权功能。
3. 暂时移除了封禁用户和解封用户功能,该功能稍后会与 RBAC 合并。会有一个专门的 “blocked-user” 角色,该角色只拥有少量接口的权限。
@cfdxkk cfdxkk added the enhancement New feature or request label Feb 8, 2025
@cfdxkk cfdxkk self-assigned this Feb 8, 2025
1. 删除旧的权限验证函数,转为 RBAC 验证
2. 删除了管理员可以无限创建邀请码的例外判定。

以下是本次加入了 RBAC 的接口:
  * /video/danmaku/emit
  * /user/update/info
  * /video/comment/emit
  * /user/blocked/info
  * /user/adminGetUserInfo
  * /user/approveUserInfo
  * /user/adminClearUserInfo
  * /video/comment/adminDeleteComment
  * /video/upload
  * /video/tus
  * /video/delete
  * /video/pending
  * /video/pending/approved
  * /video/tag/create
新增以下受 RBAC 控制的接口
 * `/rbac/deleteRbacApiPath`(删除 RBAC API 路径)
 * `/rbac/getRbacApiPath`(获取 RBAC API 路径)
 * `/rbac/deleteRbacRole`(删除 RBAC 角色)
 * `/rbac/getRbacRole`(获取 RBAC 角色)
1. 新增以下接口:
 * /rbac/adminGetUserRolesByUid - 通过 UUID 获取一个用户的角色
 * /rbac/adminUpdateUserRole - 管理员更新用户角色

2. 修复了以下接口如果没有传递任何查询参数时会报错的问题。
 * getRbacApiPathService
 * getRbacRoleService
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

1 participant