(domainId: string)
| 43 | // as Forbidden so we don't leak existence of ids outside the caller's org. |
| 44 | // Exported for its test only. |
| 45 | export 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 | |
| 57 | export const OrgHandlers = HttpApiBuilder.group(OrgHttpApi, "org", (handlers) => |
| 58 | handlers |
no outgoing calls
no test coverage detected