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

Function organizationDisplay

apps/cloud/src/auth/doc-gate.ts:154–165  ·  view source on GitHub ↗
(
  organizationId: string,
)

Source from the content-addressed store, hash-verified

152// requests, which Cloudflare forbids. A miss or failure reads as empty strings
153// — display-only, corrected by the client's /account/me write.
154const organizationDisplay = async (
155 organizationId: string,
156): Promise<{ name: string; slug: string }> => {
157 const exit = await getRuntime().runPromiseExit(
158 Effect.flatMap(UserStoreService.asEffect(), (users) =>
159 users.use("getOrganization", (store) => store.getOrganization(organizationId)),
160 ).pipe(Effect.provide(Layer.provide(makeUserStoreLayer(), makeDbLayer()))),
161 );
162 return Exit.isSuccess(exit)
163 ? { name: exit.value?.name ?? "", slug: exit.value?.slug ?? "" }
164 : { name: "", slug: "" };
165};
166
167// Live membership check for the last-org cookie's slug. Same authorize path
168// as any org selector — the cookie is a preference, so a slug the user can't

Callers 2

resolveAuthHintFunction · 0.85
doc-gate.tsFile · 0.85

Calls 3

makeUserStoreLayerFunction · 0.90
makeDbLayerFunction · 0.90
getRuntimeFunction · 0.85

Tested by

no test coverage detected