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

Function assertDomainInSessionOrg

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

Source from the content-addressed store, hash-verified

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

Callers 1

handlers.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected