Check if user is a member of the org (or a superadmin).
(user_id: int, org_id: int, db_session: AsyncSession)
| 38 | |
| 39 | |
| 40 | async def is_org_member(user_id: int, org_id: int, db_session: AsyncSession) -> bool: |
| 41 | """Check if user is a member of the org (or a superadmin).""" |
| 42 | if await is_user_superadmin(user_id, db_session): |
| 43 | logger.debug("Superadmin bypass: user %s accessed org %s", user_id, org_id) |
| 44 | return True |
| 45 | return await get_user_org(user_id, org_id, db_session) is not None |
| 46 | |
| 47 | |
| 48 | async def is_org_admin(user_id: int, org_id: int, db_session: AsyncSession) -> bool: |