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

Function organizationDisplay

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

Source from the content-addressed store, hash-verified

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

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