MCPcopy
hub / github.com/learnhouse/learnhouse / require_org_membership

Function require_org_membership

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

Raise 403 if user is not an org member and not a superadmin.

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

Source from the content-addressed store, hash-verified

64
65
66async 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
75async def require_org_admin(user_id: int, org_id: int, db_session: AsyncSession) -> None:

Callers 15

create_usergroupFunction · 0.90
create_courseFunction · 0.90
create_boardFunction · 0.90
get_boards_by_orgFunction · 0.90
duplicate_boardFunction · 0.90
create_podcastFunction · 0.90
list_custom_domainsFunction · 0.90
get_custom_domainFunction · 0.90
check_domain_ssl_statusFunction · 0.90

Calls 1

is_org_memberFunction · 0.85