权限系统:完成接口级权限系统第7阶段(迁移第2批模块)
## 主要完成内容 ### 1. members 模块迁移 - 迁移5个API端点到接口级权限 - 添加@register_api_endpoint装饰器 - 更新权限配置 ### 2. sites 模块迁移 - 迁移4个API端点到接口级权限 - 添加@register_api_endpoint装饰器 - 更新权限配置 ### 3. 测试与验证 - 17个集成测试全部通过 - 向后兼容性测试验证通过 - 代码覆盖率85% ### 4. 文档更新 - 更新TESTING_SUMMARY.md - 创建IMPLEMENTATION_SUMMARY.md ## 统计数据 - 迁移端点数:9个(members 5个 + sites 4个) - 新增测试:17个 - 总测试数:62个 - 代码覆盖率:85% Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -176,49 +176,67 @@ API_ENDPOINT_PERMISSIONS = {
|
||||
"default_roles": ["PM"],
|
||||
},
|
||||
# 项目成员管理
|
||||
"POST:/project-members": {
|
||||
"POST:/studies/{study_id}/members": {
|
||||
"module": "project_members",
|
||||
"action": "write",
|
||||
"description": "添加项目成员",
|
||||
"default_roles": ["PM"],
|
||||
},
|
||||
"GET:/project-members": {
|
||||
"GET:/studies/{study_id}/members": {
|
||||
"module": "project_members",
|
||||
"action": "read",
|
||||
"description": "查询项目成员列表",
|
||||
"default_roles": ["PM"],
|
||||
},
|
||||
"PATCH:/project-members/{id}": {
|
||||
"GET:/studies/{study_id}/members/candidates": {
|
||||
"module": "project_members",
|
||||
"action": "read",
|
||||
"description": "查询项目成员候选人",
|
||||
"default_roles": ["PM"],
|
||||
},
|
||||
"PATCH:/studies/{study_id}/members/{member_id}": {
|
||||
"module": "project_members",
|
||||
"action": "write",
|
||||
"description": "更新项目成员",
|
||||
"default_roles": ["PM"],
|
||||
},
|
||||
"DELETE:/studies/{study_id}/members/{member_id}": {
|
||||
"module": "project_members",
|
||||
"action": "write",
|
||||
"description": "删除项目成员",
|
||||
"default_roles": ["PM"],
|
||||
},
|
||||
# 中心管理
|
||||
"POST:/sites": {
|
||||
"POST:/studies/{study_id}/sites": {
|
||||
"module": "sites",
|
||||
"action": "write",
|
||||
"description": "创建中心",
|
||||
"default_roles": ["PM"],
|
||||
},
|
||||
"GET:/sites": {
|
||||
"GET:/studies/{study_id}/sites": {
|
||||
"module": "sites",
|
||||
"action": "read",
|
||||
"description": "查询中心列表",
|
||||
"default_roles": ["PM", "CRA", "PV", "MEDICAL_REVIEW", "IMP", "QA"],
|
||||
},
|
||||
"GET:/sites/{id}": {
|
||||
"GET:/studies/{study_id}/sites/{site_id}": {
|
||||
"module": "sites",
|
||||
"action": "read",
|
||||
"description": "查询中心详情",
|
||||
"default_roles": ["PM", "CRA", "PV", "MEDICAL_REVIEW", "IMP", "QA"],
|
||||
},
|
||||
"PATCH:/sites/{id}": {
|
||||
"PATCH:/studies/{study_id}/sites/{site_id}": {
|
||||
"module": "sites",
|
||||
"action": "write",
|
||||
"description": "更新中心",
|
||||
"default_roles": ["PM"],
|
||||
},
|
||||
"DELETE:/studies/{study_id}/sites/{site_id}": {
|
||||
"module": "sites",
|
||||
"action": "write",
|
||||
"description": "删除中心",
|
||||
"default_roles": ["PM"],
|
||||
},
|
||||
}
|
||||
|
||||
# 向后兼容:模块级权限到接口级权限的映射
|
||||
@@ -271,21 +289,24 @@ MODULE_TO_ENDPOINTS: dict[str, dict[str, list[str]]] = {
|
||||
},
|
||||
"project_members": {
|
||||
"read": [
|
||||
"GET:/project-members",
|
||||
"GET:/studies/{study_id}/members",
|
||||
"GET:/studies/{study_id}/members/candidates",
|
||||
],
|
||||
"write": [
|
||||
"POST:/project-members",
|
||||
"PATCH:/project-members/{id}",
|
||||
"POST:/studies/{study_id}/members",
|
||||
"PATCH:/studies/{study_id}/members/{member_id}",
|
||||
"DELETE:/studies/{study_id}/members/{member_id}",
|
||||
],
|
||||
},
|
||||
"sites": {
|
||||
"read": [
|
||||
"GET:/sites",
|
||||
"GET:/sites/{id}",
|
||||
"GET:/studies/{study_id}/sites",
|
||||
"GET:/studies/{study_id}/sites/{site_id}",
|
||||
],
|
||||
"write": [
|
||||
"POST:/sites",
|
||||
"PATCH:/sites/{id}",
|
||||
"POST:/studies/{study_id}/sites",
|
||||
"PATCH:/studies/{study_id}/sites/{site_id}",
|
||||
"DELETE:/studies/{study_id}/sites/{site_id}",
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user