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

Function authorizeOrganization

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

Source from the content-addressed store, hash-verified

79// 403).
80
81export const authorizeOrganization = (userId: string, organizationId: string) =>
82 Effect.gen(function* () {
83 const workos = yield* WorkOSClient;
84 const memberships = yield* workos.listUserMemberships(userId);
85 const active = memberships.data.find(
86 (m: { readonly organizationId: string; readonly status: string }) =>
87 m.organizationId === organizationId && m.status === "active",
88 );
89 if (!active) return null;
90
91 return yield* resolveOrganization(organizationId);
92 });
93
94// ---------------------------------------------------------------------------
95// Org SELECTOR — the URL is the scope authority, not the session.

Callers 5

resolveJwtPrincipalFunction · 0.90
resolveBearerAuthFunction · 0.90
handlers.tsFile · 0.90
auth.tsFile · 0.90

Calls 1

resolveOrganizationFunction · 0.85

Tested by

no test coverage detected