中文:收口权限与中心/立项配置改造

This commit is contained in:
Cheng Zhou
2026-05-12 10:16:52 +08:00
parent 6e90370a5f
commit 77e842637d
67 changed files with 706 additions and 669 deletions
+2 -3
View File
@@ -32,9 +32,8 @@ ROLE_ACTIONS: dict[str, set[str]] = {
def is_allowed(action: str, user, membership) -> bool:
role_value = user.role.value if hasattr(user.role, "value") else str(user.role)
allowed = ROLE_ACTIONS.get(role_value, set())
if action in allowed:
return True
if role_value == "ADMIN":
return action in ROLE_ACTIONS["ADMIN"]
member_role = getattr(membership, "role_in_study", None)
if member_role:
return action in ROLE_ACTIONS.get(member_role, set())