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

Function assertDomainInSessionOrg

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

Source from the content-addressed store, hash-verified

38// ownership on delete by id. Failures (not found OR org mismatch) both surface
39// as Forbidden so we don't leak existence of ids outside the caller's org.
40const assertDomainInSessionOrg = (domainId: string) =>
41 Effect.gen(function* () {
42 const auth = yield* AuthContext;
43 const workos = yield* WorkOSClient;
44 const domain = yield* workos
45 .getOrganizationDomain(domainId)
46 .pipe(Effect.catchCause(() => Effect.succeed(null)));
47 if (!domain || domain.organizationId !== auth.organizationId) {
48 return yield* new Forbidden();
49 }
50 });
51
52export const OrgHandlers = HttpApiBuilder.group(OrgHttpApi, "org", (handlers) =>
53 handlers

Callers 1

handlers.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected