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

Function authorizeOrganization

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

Source from the content-addressed store, hash-verified

77// 403).
78
79export const authorizeOrganization = (userId: string, organizationId: string) =>
80 Effect.gen(function* () {
81 const workos = yield* WorkOSClient;
82 const memberships = yield* workos.listUserMemberships(userId);
83 const active = memberships.data.find(
84 (m: { readonly organizationId: string; readonly status: string }) =>
85 m.organizationId === organizationId && m.status === "active",
86 );
87 if (!active) return null;
88
89 return yield* resolveOrganization(organizationId);
90 });
91
92// ---------------------------------------------------------------------------
93// 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