统一项目角色与接口权限配置

This commit is contained in:
Cheng Zhou
2026-05-28 10:48:33 +08:00
parent 6d1c98bcae
commit 2c85742040
45 changed files with 2863 additions and 1329 deletions
File diff suppressed because it is too large Load Diff
+5
View File
@@ -48,6 +48,9 @@ async def role_has_api_permission(
check_prerequisites: bool = True,
) -> bool:
"""检查角色是否有权访问特定接口"""
if endpoint_key not in API_ENDPOINT_PERMISSIONS:
return False
if role == "ADMIN":
return True
@@ -129,6 +132,8 @@ async def get_api_endpoint_permissions(
if role not in matrix:
matrix[role] = {}
for endpoint_key, allowed in endpoints.items():
if endpoint_key not in API_ENDPOINT_PERMISSIONS:
continue
matrix[role][endpoint_key] = {"allowed": allowed}
return matrix
+1 -1
View File
@@ -25,7 +25,7 @@ ROLE_ACTIONS: dict[str, set[str]] = {
"PM": {"view", "create_document", "create_version", "submit", "approve", "distribute", "ack", "delete_document"},
"CRA": {"view", "create_version", "submit", "ack"},
"PV": {"view", "create_version", "submit", "ack"},
"IMP": {"view", "create_version", "submit", "ack"},
"CTA": {"view", "create_version", "submit", "ack"},
}