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

Function authorize

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

Source from the content-addressed store, hash-verified

623 * read dies).
624 */
625 const authorize = (
626 userId: string,
627 org: string,
628 workos: Layer.Layer<WorkOSClient> = stubWorkOS({}),
629 ) =>
630 Effect.runPromise(
631 authorizeOrganization(userId, org).pipe(
632 Effect.provide(
633 Layer.mergeAll(UserStoreService.Live, WorkOsMirror.Live, cloudMemberDirectoryLayer).pipe(
634 Layer.provideMerge(DbService.Live),
635 ),
636 ),
637 Effect.provide(workos),
638 Effect.scoped,
639 ),
640 );
641
642 /** Whether `userId` is authorized for `org` right now. */
643 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