a17f4cc522
- 新增项目成员候选用户接口,避免 PM 读取全局用户列表 - 按项目角色和权限矩阵控制项目管理、成员、中心与审计入口 - 合并侧边栏管理后台入口,统一从项目管理进入成员等模块 - 加强成员管理安全约束,禁止 PM 修改自己、系统管理员或更高权限角色 - 修复多项目角色缓存串用问题,并补充前后端回归测试
35 lines
806 B
Python
35 lines
806 B
Python
import uuid
|
|
from datetime import datetime
|
|
from typing import Literal, Optional
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
from app.schemas.user import UserResponse
|
|
|
|
StudyRole = Literal["PM", "CRA", "PV", "MEDICAL_REVIEW", "IMP", "QA", "ADMIN"]
|
|
|
|
|
|
class StudyMemberCreate(BaseModel):
|
|
user_id: uuid.UUID
|
|
role_in_study: StudyRole
|
|
is_active: bool = True
|
|
|
|
|
|
class StudyMemberUpdate(BaseModel):
|
|
role_in_study: Optional[StudyRole] = None
|
|
is_active: Optional[bool] = None
|
|
|
|
|
|
class StudyMemberRead(BaseModel):
|
|
id: uuid.UUID
|
|
study_id: uuid.UUID
|
|
user_id: uuid.UUID
|
|
role_in_study: StudyRole
|
|
is_active: bool
|
|
added_at: datetime
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
class StudyMemberReadWithUser(StudyMemberRead):
|
|
user: Optional[UserResponse] = None
|