Raise 403 if user is not an org admin/maintainer and not a superadmin.
(user_id: int, org_id: int, db_session: AsyncSession)
| 73 | |
| 74 | |
| 75 | async def require_org_admin(user_id: int, org_id: int, db_session: AsyncSession) -> None: |
| 76 | """Raise 403 if user is not an org admin/maintainer and not a superadmin.""" |
| 77 | if not await is_org_admin(user_id, org_id, db_session): |
| 78 | raise HTTPException( |
| 79 | status_code=status.HTTP_403_FORBIDDEN, |
| 80 | detail="Only organization administrators and maintainers can perform this action", |
| 81 | ) |
| 82 | |
| 83 | |
| 84 | async def require_org_role_permission( |