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

Function authorize

apps/cloud/src/auth/mirror-feeders.node.test.ts:628–643  ·  view source on GitHub ↗
(
    userId: string,
    org: string,
    workos: Layer.Layer<WorkOSClient> = stubWorkOS({}),
  )

Source from the content-addressed store, hash-verified

626 * read dies).
627 */
628 const authorize = (
629 userId: string,
630 org: string,
631 workos: Layer.Layer<WorkOSClient> = stubWorkOS({}),
632 ) =>
633 Effect.runPromise(
634 authorizeOrganization(userId, org).pipe(
635 Effect.provide(
636 Layer.mergeAll(UserStoreService.Live, WorkOsMirror.Live, cloudMemberDirectoryLayer).pipe(
637 Layer.provideMerge(DbService.Live),
638 ),
639 ),
640 Effect.provide(workos),
641 Effect.scoped,
642 ),
643 );
644
645 /** Whether `userId` is authorized for `org` right now. */
646 const authorized = async (userId: string, org: string) => (await authorize(userId, org)) !== null;

Callers 3

authorizedFunction · 0.70
stubProviderFunction · 0.50

Calls 2

authorizeOrganizationFunction · 0.90
stubWorkOSFunction · 0.70

Tested by

no test coverage detected