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

Function assertDomainInSessionOrg

apps/cloud/src/org/handlers.ts:45–55  ·  view source on GitHub ↗
(domainId: string)

Source from the content-addressed store, hash-verified

43// as Forbidden so we don't leak existence of ids outside the caller's org.
44// Exported for its test only.
45export const assertDomainInSessionOrg = (domainId: string) =>
46 Effect.gen(function* () {
47 const auth = yield* AuthContext;
48 const workos = yield* WorkOSClient;
49 const domain = yield* workos
50 .getOrganizationDomain(domainId)
51 .pipe(Effect.catchCause(() => Effect.succeed(null)));
52 if (!domain || domain.organizationId !== auth.organizationId) {
53 return yield* new Forbidden();
54 }
55 });
56
57export const OrgHandlers = HttpApiBuilder.group(OrgHttpApi, "org", (handlers) =>
58 handlers

Callers 2

handlers.test.tsFile · 0.90
handlers.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected