权限系统:完成接口级权限系统第8阶段(迁移第3批模块)

## 主要完成内容

### 1. 第一优先级模块迁移
- startup.py:19个端点(伦理审批、可行性评估、预算、时间表)
- project_permissions.py:2个端点(项目权限查询、更新)
- overview.py:1个端点(项目概览)

### 2. 第二优先级模块迁移
- monitoring_visit_issues.py:7个端点(监查问题管理)
- drug_shipments.py:5个端点(药物发货管理)
- material_equipments.py:5个端点(物资管理)
- subject_pds.py:4个端点(参与者PDS)
- audit_logs.py:3个端点(审计日志)

### 3. 第三优先级模块迁移
- visits.py:5个端点(访视管理)
- knowledge_notes.py:5个端点(知识库笔记)
- subject_histories.py:5个端点(参与者历史)
- project_milestones.py:2个端点(项目里程碑)

### 4. 测试与验证
- 34个集成测试全部通过
- 13个配置测试全部通过
- 109个总测试全部通过
- 代码覆盖率≥80%

### 5. 文档更新
- 更新TESTING_SUMMARY.md
- 更新IMPLEMENTATION_SUMMARY.md

## 统计数据

- 迁移端点数:63个
- 迁移模块数:12个
- 新增测试:34个
- 总测试数:109个
- 代码覆盖率:85%
- 已迁移端点总数:94个(第1-3批)

## 权限配置修复

修复了api_permissions.py中的模块名称映射,确保所有63个端点的模块名称与DEFAULT_PROJECT_ROLE_PERMISSIONS中的有效模块名称一致。

## 测试修复

修复了test_api_permissions_config.py中的两个测试用例:
- test_project_members_endpoints_configured:更新为使用正确的/studies/{study_id}/members路径
- test_sites_endpoints_configured:更新为使用正确的/studies/{study_id}/sites路径

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Cheng Zhou
2026-05-13 17:08:55 +08:00
parent 3c66ac9b37
commit 1fec510e2e
5 changed files with 1306 additions and 71 deletions
+10 -7
View File
@@ -86,9 +86,11 @@ def test_fees_endpoints_configured():
def test_project_members_endpoints_configured():
"""测试project_members模块的端点配置"""
expected_endpoints = [
"POST:/project-members",
"GET:/project-members",
"PATCH:/project-members/{id}",
"POST:/studies/{study_id}/members",
"GET:/studies/{study_id}/members",
"GET:/studies/{study_id}/members/candidates",
"PATCH:/studies/{study_id}/members/{member_id}",
"DELETE:/studies/{study_id}/members/{member_id}",
]
for endpoint_key in expected_endpoints:
assert endpoint_key in API_ENDPOINT_PERMISSIONS, f"Missing endpoint {endpoint_key}"
@@ -98,10 +100,11 @@ def test_project_members_endpoints_configured():
def test_sites_endpoints_configured():
"""测试sites模块的端点配置"""
expected_endpoints = [
"POST:/sites",
"GET:/sites",
"GET:/sites/{id}",
"PATCH:/sites/{id}",
"POST:/studies/{study_id}/sites",
"GET:/studies/{study_id}/sites",
"GET:/studies/{study_id}/sites/{site_id}",
"PATCH:/studies/{study_id}/sites/{site_id}",
"DELETE:/studies/{study_id}/sites/{site_id}",
]
for endpoint_key in expected_endpoints:
assert endpoint_key in API_ENDPOINT_PERMISSIONS, f"Missing endpoint {endpoint_key}"