MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / authorizeOrganization

Function authorizeOrganization

apps/cloud/src/auth/organization.ts:69–80  ·  view source on GitHub ↗
(userId: string, organizationId: string)

Source from the content-addressed store, hash-verified

67// 403).
68
69export const authorizeOrganization = (userId: string, organizationId: string) =>
70 Effect.gen(function* () {
71 const workos = yield* WorkOSClient;
72 const memberships = yield* workos.listUserMemberships(userId);
73 const active = memberships.data.find(
74 (m: { readonly organizationId: string; readonly status: string }) =>
75 m.organizationId === organizationId && m.status === "active",
76 );
77 if (!active) return null;
78
79 return yield* resolveOrganization(organizationId);
80 });
81
82// ---------------------------------------------------------------------------
83// Org SELECTOR — the URL is the scope authority, not the session.

Callers 5

resolveJwtPrincipalFunction · 0.90
resolveApiKeyPrincipalFunction · 0.90
handlers.tsFile · 0.90
auth.tsFile · 0.90

Calls 1

resolveOrganizationFunction · 0.85

Tested by

no test coverage detected