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

Function authorizeLastOrgSlug

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

Source from the content-addressed store, hash-verified

173// canonicalize-onto-session-org behavior. Per-request store layers for the
174// same reason as organizationDisplay; both stores share the one socket.
175const authorizeLastOrgSlug = async (
176 userId: string,
177 slug: string,
178): Promise<{ readonly id: string } | null> => {
179 const dbLive = makeDbLayer();
180 const exit = await getRuntime().runPromiseExit(
181 authorizeOrganizationSelector(userId, slug).pipe(
182 Effect.provide(
183 Layer.mergeAll(
184 makeUserStoreLayer(),
185 makeMemberDirectoryLayer(),
186 makeWorkOsMirrorLayer(),
187 ).pipe(Layer.provide(dbLive)),
188 ),
189 ),
190 );
191 return Exit.isSuccess(exit) ? exit.value : null;
192};
193
194const hintSetCookie = (hint: AuthHint) =>
195 `${AUTH_HINT_COOKIE}=${encodeAuthHint(hint)}; ${HINT_COOKIE_ATTRIBUTES}; Max-Age=${AUTH_HINT_MAX_AGE_SECONDS}`;

Callers 1

doc-gate.tsFile · 0.85

Calls 6

makeDbLayerFunction · 0.90
makeUserStoreLayerFunction · 0.90
makeMemberDirectoryLayerFunction · 0.90
makeWorkOsMirrorLayerFunction · 0.90
getRuntimeFunction · 0.85

Tested by

no test coverage detected