MCPcopy
hub / github.com/learnhouse/learnhouse / is_org_member

Function is_org_member

apps/api/src/security/org_auth.py:40–45  ·  view source on GitHub ↗

Check if user is a member of the org (or a superadmin).

(user_id: int, org_id: int, db_session: AsyncSession)

Source from the content-addressed store, hash-verified

38
39
40async 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
48async def is_org_admin(user_id: int, org_id: int, db_session: AsyncSession) -> bool:

Calls 2

is_user_superadminFunction · 0.90
get_user_orgFunction · 0.85