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

Function authorizeLastOrgSlug

apps/cloud/src/auth/doc-gate.ts:172–182  ·  view source on GitHub ↗
(
  userId: string,
  slug: string,
)

Source from the content-addressed store, hash-verified

170// bare path falls through to today's canonicalize-onto-session-org behavior.
171// Per-request store layers for the same reason as organizationDisplay.
172const authorizeLastOrgSlug = async (
173 userId: string,
174 slug: string,
175): Promise<{ readonly id: string } | null> => {
176 const exit = await getRuntime().runPromiseExit(
177 authorizeOrganizationSelector(userId, slug).pipe(
178 Effect.provide(Layer.provide(makeUserStoreLayer(), makeDbLayer())),
179 ),
180 );
181 return Exit.isSuccess(exit) ? exit.value : null;
182};
183
184const hintSetCookie = (hint: AuthHint) =>
185 `${AUTH_HINT_COOKIE}=${encodeAuthHint(hint)}; ${HINT_COOKIE_ATTRIBUTES}; Max-Age=${AUTH_HINT_MAX_AGE_SECONDS}`;

Callers 1

doc-gate.tsFile · 0.85

Calls 4

makeUserStoreLayerFunction · 0.90
makeDbLayerFunction · 0.90
getRuntimeFunction · 0.85

Tested by

no test coverage detected