feat(permission): replace OA roles with post-bound roles and assignee posts
Unify effective roles via post-role bindings, remove dedicated OA role UI, and update OA assignee resolution plus related SQL/docs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
a3c73d76bb
commit
06db3bc966
66 files changed
+55337
-38647
No files matched your search
@@ -20,7 +20,6 @@ from app.models.models import (
|
||||
SysRole,
|
||||
SysRoleDataScopeDetail,
|
||||
SysUser,
|
||||
SysUserRole,
|
||||
)
|
||||
|
||||
|
||||
@@ -62,17 +61,20 @@ def _get_child_dept_ids(db: Session, dept_id: str, tenant_no: str) -> List[str]:
|
||||
def _resolve_user_role_scopes(
|
||||
db: Session, user_id: str, tenant_no: str
|
||||
) -> List[dict]:
|
||||
"""获取用户所有角色的数据权限配置。
|
||||
"""获取用户有效角色的数据权限配置(直接角色 ∪ 职位继承角色)。
|
||||
|
||||
返回: [{"data_scope": str, "details": [SysRoleDataScopeDetail, ...]}]
|
||||
"""
|
||||
from app.services.web_auth_roles import get_effective_role_ids
|
||||
|
||||
role_ids = get_effective_role_ids(db, user_id)
|
||||
if not role_ids:
|
||||
return []
|
||||
|
||||
roles = (
|
||||
db.query(SysRole)
|
||||
.join(SysUserRole, SysUserRole.role_id == SysRole.id)
|
||||
.filter(
|
||||
SysUserRole.user_id == user_id,
|
||||
SysUserRole.del_flag == 0,
|
||||
SysUserRole.tenant_no == tenant_no,
|
||||
SysRole.id.in_(role_ids),
|
||||
SysRole.del_flag == 0,
|
||||
SysRole.status == "1",
|
||||
SysRole.tenant_no == tenant_no,
|
||||
@@ -83,7 +85,6 @@ def _resolve_user_role_scopes(
|
||||
return []
|
||||
|
||||
result: List[dict] = []
|
||||
role_ids = [r.id for r in roles]
|
||||
|
||||
# 批量查所有自定义权限明细
|
||||
all_details = (
|
||||
|
||||
Reference in new issue
Block a user