Raise 403 if user is not an org member and not a superadmin.
(user_id: int, org_id: int, db_session: AsyncSession)
| 64 | |
| 65 | |
| 66 | async def require_org_membership(user_id: int, org_id: int, db_session: AsyncSession) -> None: |
| 67 | """Raise 403 if user is not an org member and not a superadmin.""" |
| 68 | if not await is_org_member(user_id, org_id, db_session): |
| 69 | raise HTTPException( |
| 70 | status_code=status.HTTP_403_FORBIDDEN, |
| 71 | detail="You are not a member of this organization", |
| 72 | ) |
| 73 | |
| 74 | |
| 75 | async def require_org_admin(user_id: int, org_id: int, db_session: AsyncSession) -> None: |