(
userId: string,
org: string,
workos: Layer.Layer<WorkOSClient> = stubWorkOS({}),
)
| 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; |
no test coverage detected