@webiny/api-aco 6.6.0-alpha.1 → 6.6.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AcoFeature.js +14 -36
- package/AcoFeature.js.map +1 -1
- package/AcoFolderSchemaFactory.d.ts +2 -0
- package/AcoFolderSchemaFactory.js +25 -7
- package/AcoFolderSchemaFactory.js.map +1 -1
- package/domain/folder/folder.model.js +2 -1
- package/domain/folder/folder.model.js.map +1 -1
- package/exports/api/aco/flp.d.ts +3 -3
- package/exports/api/aco/flp.js +2 -3
- package/features/ai/CreateFolderTool.d.ts +11 -6
- package/features/ai/CreateFolderTool.js +20 -11
- package/features/ai/CreateFolderTool.js.map +1 -1
- package/features/ai/CreateTeamTool.d.ts +11 -6
- package/features/ai/CreateTeamTool.js +20 -11
- package/features/ai/CreateTeamTool.js.map +1 -1
- package/features/ai/DeleteFolderTool.d.ts +48 -0
- package/features/ai/DeleteFolderTool.js +55 -0
- package/features/ai/DeleteFolderTool.js.map +1 -0
- package/features/ai/GrantFolderAccessTool.d.ts +13 -8
- package/features/ai/GrantFolderAccessTool.js +20 -11
- package/features/ai/GrantFolderAccessTool.js.map +1 -1
- package/features/ai/ListFoldersTool.d.ts +11 -6
- package/features/ai/ListFoldersTool.js +21 -12
- package/features/ai/ListFoldersTool.js.map +1 -1
- package/features/ai/ListRolesTool.d.ts +11 -6
- package/features/ai/ListRolesTool.js +21 -12
- package/features/ai/ListRolesTool.js.map +1 -1
- package/features/ai/ListTeamsTool.d.ts +11 -6
- package/features/ai/ListTeamsTool.js +21 -12
- package/features/ai/ListTeamsTool.js.map +1 -1
- package/features/ai/RevokeFolderAccessTool.d.ts +12 -7
- package/features/ai/RevokeFolderAccessTool.js +21 -12
- package/features/ai/RevokeFolderAccessTool.js.map +1 -1
- package/features/ai/feature.d.ts +1 -1
- package/features/ai/feature.js +2 -0
- package/features/ai/feature.js.map +1 -1
- package/features/ai/index.d.ts +1 -0
- package/features/ai/index.js +1 -0
- package/features/cms/decorators/ListDeletedEntriesWithFlpDecorator.d.ts +4 -4
- package/features/cms/decorators/ListDeletedEntriesWithFlpDecorator.js +7 -8
- package/features/cms/decorators/ListDeletedEntriesWithFlpDecorator.js.map +1 -1
- package/features/cms/decorators/ListEntriesWithFlpDecorator.d.ts +3 -3
- package/features/cms/decorators/ListEntriesWithFlpDecorator.js +7 -8
- package/features/cms/decorators/ListEntriesWithFlpDecorator.js.map +1 -1
- package/features/cms/decorators/ListLatestEntriesWithFlpDecorator.d.ts +4 -4
- package/features/cms/decorators/ListLatestEntriesWithFlpDecorator.js +7 -8
- package/features/cms/decorators/ListLatestEntriesWithFlpDecorator.js.map +1 -1
- package/features/cms/decorators/ListPublishedEntriesWithFlpDecorator.d.ts +4 -4
- package/features/cms/decorators/ListPublishedEntriesWithFlpDecorator.js +7 -8
- package/features/cms/decorators/ListPublishedEntriesWithFlpDecorator.js.map +1 -1
- package/features/flp/CreateFlp/index.d.ts +0 -1
- package/features/flp/CreateFlp/index.js +0 -1
- package/features/flp/DeleteFlp/index.d.ts +0 -1
- package/features/flp/DeleteFlp/index.js +0 -1
- package/features/flp/FolderAccessListFilter/abstractions.d.ts +33 -0
- package/features/flp/FolderAccessListFilter/abstractions.js +5 -0
- package/features/flp/FolderAccessListFilter/abstractions.js.map +1 -0
- package/features/flp/FolderAccessListFilter/index.d.ts +1 -0
- package/features/flp/FolderAccessListFilter/index.js +1 -0
- package/features/flp/FolderCatalogSync/FolderCatalogSyncHandlersFeature.d.ts +8 -0
- package/features/flp/FolderCatalogSync/FolderCatalogSyncHandlersFeature.js +15 -0
- package/features/flp/FolderCatalogSync/FolderCatalogSyncHandlersFeature.js.map +1 -0
- package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderCreatedHandler.d.ts +11 -0
- package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderCreatedHandler.js +19 -0
- package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderCreatedHandler.js.map +1 -0
- package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderDeletedHandler.d.ts +11 -0
- package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderDeletedHandler.js +19 -0
- package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderDeletedHandler.js.map +1 -0
- package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderUpdatedHandler.d.ts +11 -0
- package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderUpdatedHandler.js +23 -0
- package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderUpdatedHandler.js.map +1 -0
- package/features/flp/FolderCatalogSync/abstractions.d.ts +25 -0
- package/features/flp/FolderCatalogSync/abstractions.js +5 -0
- package/features/flp/FolderCatalogSync/abstractions.js.map +1 -0
- package/features/flp/FolderCatalogSync/index.d.ts +2 -0
- package/features/flp/FolderCatalogSync/index.js +2 -0
- package/features/flp/FolderLevelPermissions/FolderLevelPermissions.d.ts +5 -2
- package/features/flp/FolderLevelPermissions/FolderLevelPermissions.js +19 -5
- package/features/flp/FolderLevelPermissions/FolderLevelPermissions.js.map +1 -1
- package/features/flp/FolderLevelPermissions/NoopFolderLevelPermissions.d.ts +1 -0
- package/features/flp/FolderLevelPermissions/NoopFolderLevelPermissions.js +3 -0
- package/features/flp/FolderLevelPermissions/NoopFolderLevelPermissions.js.map +1 -1
- package/features/flp/FolderLevelPermissions/abstractions.d.ts +8 -2
- package/features/flp/FolderLevelPermissions/abstractions.js.map +1 -1
- package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.d.ts +12 -0
- package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.js +22 -14
- package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.js.map +1 -1
- package/features/flp/FolderPermissionsRepository/abstractions.d.ts +28 -0
- package/features/flp/FolderPermissionsRepository/abstractions.js +5 -0
- package/features/flp/FolderPermissionsRepository/abstractions.js.map +1 -0
- package/features/flp/FolderPermissionsRepository/index.d.ts +1 -0
- package/features/flp/FolderPermissionsRepository/index.js +1 -0
- package/features/flp/GetFlp/GetFlpUseCase.d.ts +10 -5
- package/features/flp/GetFlp/GetFlpUseCase.js +13 -5
- package/features/flp/GetFlp/GetFlpUseCase.js.map +1 -1
- package/features/flp/GetFlp/decorators/GetFlpWithCodeFlps.d.ts +13 -0
- package/features/flp/GetFlp/decorators/GetFlpWithCodeFlps.js +26 -0
- package/features/flp/GetFlp/decorators/GetFlpWithCodeFlps.js.map +1 -0
- package/features/flp/GetFlp/feature.js +1 -3
- package/features/flp/GetFlp/feature.js.map +1 -1
- package/features/flp/ListFlps/ListFlpsUseCase.d.ts +11 -6
- package/features/flp/ListFlps/ListFlpsUseCase.js +13 -5
- package/features/flp/ListFlps/ListFlpsUseCase.js.map +1 -1
- package/features/flp/ListFlps/abstractions.d.ts +3 -9
- package/features/flp/ListFlps/abstractions.js.map +1 -1
- package/features/flp/ListFlps/decorators/ListFlpsWithCodeFlps.d.ts +13 -0
- package/features/flp/ListFlps/decorators/ListFlpsWithCodeFlps.js +27 -0
- package/features/flp/ListFlps/decorators/ListFlpsWithCodeFlps.js.map +1 -0
- package/features/flp/ListFlps/feature.js +1 -3
- package/features/flp/ListFlps/feature.js.map +1 -1
- package/features/flp/ListFolderAccess/GetUserEntryAccessUseCase.d.ts +14 -0
- package/features/flp/ListFolderAccess/GetUserEntryAccessUseCase.js +36 -0
- package/features/flp/ListFolderAccess/GetUserEntryAccessUseCase.js.map +1 -0
- package/features/flp/ListFolderAccess/GetUserFolderAccessUseCase.d.ts +25 -0
- package/features/flp/ListFolderAccess/GetUserFolderAccessUseCase.js +75 -0
- package/features/flp/ListFolderAccess/GetUserFolderAccessUseCase.js.map +1 -0
- package/features/flp/ListFolderAccess/ListEntryAccessUseCase.d.ts +13 -0
- package/features/flp/ListFolderAccess/ListEntryAccessUseCase.js +28 -0
- package/features/flp/ListFolderAccess/ListEntryAccessUseCase.js.map +1 -0
- package/features/flp/ListFolderAccess/ListFolderAccessUseCase.d.ts +24 -0
- package/features/flp/ListFolderAccess/ListFolderAccessUseCase.js +107 -0
- package/features/flp/ListFolderAccess/ListFolderAccessUseCase.js.map +1 -0
- package/features/flp/ListFolderAccess/ListUserFolderAccessUseCase.d.ts +28 -0
- package/features/flp/ListFolderAccess/ListUserFolderAccessUseCase.js +98 -0
- package/features/flp/ListFolderAccess/ListUserFolderAccessUseCase.js.map +1 -0
- package/features/flp/ListFolderAccess/UserFolderCandidates.d.ts +13 -0
- package/features/flp/ListFolderAccess/UserFolderCandidates.js +26 -0
- package/features/flp/ListFolderAccess/UserFolderCandidates.js.map +1 -0
- package/features/flp/ListFolderAccess/abstractions.d.ts +182 -0
- package/features/flp/ListFolderAccess/abstractions.js +10 -0
- package/features/flp/ListFolderAccess/abstractions.js.map +1 -0
- package/features/flp/{CreateFlpOnFolderCreated → ListFolderAccess}/feature.d.ts +1 -1
- package/features/flp/ListFolderAccess/feature.js +21 -0
- package/features/flp/ListFolderAccess/feature.js.map +1 -0
- package/features/flp/ListFolderAccess/index.d.ts +2 -0
- package/features/flp/ListFolderAccess/index.js +2 -0
- package/features/flp/ListFolderAccess/mayAskAboutUser.d.ts +3 -0
- package/features/flp/ListFolderAccess/mayAskAboutUser.js +9 -0
- package/features/flp/ListFolderAccess/mayAskAboutUser.js.map +1 -0
- package/features/flp/ListFolderAccess/userFolderLevel.d.ts +31 -0
- package/features/flp/ListFolderAccess/userFolderLevel.js +48 -0
- package/features/flp/ListFolderAccess/userFolderLevel.js.map +1 -0
- package/features/flp/UpdateFlp/abstractions.d.ts +6 -2
- package/features/flp/UpdateFlp/abstractions.js.map +1 -1
- package/features/flp/UpdateFlp/index.d.ts +0 -1
- package/features/flp/UpdateFlp/index.js +0 -1
- package/features/flp/shared/CodeFlpMerger.d.ts +26 -0
- package/features/flp/shared/CodeFlpMerger.js +20 -0
- package/features/flp/shared/CodeFlpMerger.js.map +1 -0
- package/features/flp/shared/CodeFlpPath.d.ts +15 -0
- package/features/flp/shared/CodeFlpPath.js +29 -0
- package/features/flp/shared/CodeFlpPath.js.map +1 -0
- package/features/flp/shared/CodeFlpTarget.d.ts +10 -0
- package/features/flp/shared/CodeFlpTarget.js +26 -0
- package/features/flp/shared/CodeFlpTarget.js.map +1 -0
- package/features/flp/shared/CodeFlpsProvider.d.ts +15 -0
- package/features/flp/shared/CodeFlpsProvider.js +36 -0
- package/features/flp/shared/CodeFlpsProvider.js.map +1 -0
- package/features/flp/shared/abstractions.d.ts +79 -0
- package/features/flp/shared/abstractions.js +19 -0
- package/features/flp/shared/abstractions.js.map +1 -0
- package/features/flp/shared/feature.d.ts +5 -0
- package/features/flp/shared/feature.js +17 -0
- package/features/flp/shared/feature.js.map +1 -0
- package/features/flp/shared/index.d.ts +4 -0
- package/features/flp/shared/index.js +4 -0
- package/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.d.ts +9 -1
- package/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.js +20 -3
- package/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.js.map +1 -1
- package/features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.d.ts +3 -7
- package/features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.js +5 -50
- package/features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.js.map +1 -1
- package/features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.d.ts +11 -0
- package/features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.js +38 -0
- package/features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.js.map +1 -0
- package/features/{flp/DeleteFlpOnFolderDeleted/DeleteFlpOnFolderDeletedHandler.d.ts → folder/NotifyFolderChange/NotifyOnFolderDeletedHandler.d.ts} +5 -7
- package/features/folder/NotifyFolderChange/NotifyOnFolderDeletedHandler.js +24 -0
- package/features/folder/NotifyFolderChange/NotifyOnFolderDeletedHandler.js.map +1 -0
- package/features/folder/NotifyFolderChange/abstractions.d.ts +28 -0
- package/features/folder/NotifyFolderChange/abstractions.js +8 -0
- package/features/folder/NotifyFolderChange/abstractions.js.map +1 -0
- package/features/folder/NotifyFolderChange/feature.d.ts +8 -0
- package/features/folder/NotifyFolderChange/feature.js +13 -0
- package/features/folder/NotifyFolderChange/feature.js.map +1 -0
- package/features/folder/NotifyFolderChange/index.d.ts +2 -0
- package/features/folder/NotifyFolderChange/index.js +2 -0
- package/features/folder/UpdateFolder/decorators/UpdateFolderWithFolderLevelPermissions.d.ts +14 -1
- package/features/folder/UpdateFolder/decorators/UpdateFolderWithFolderLevelPermissions.js +52 -4
- package/features/folder/UpdateFolder/decorators/UpdateFolderWithFolderLevelPermissions.js.map +1 -1
- package/filter/filter.model.js +2 -1
- package/filter/filter.model.js.map +1 -1
- package/filter/filter.so.d.ts +0 -2
- package/filter/filter.so.js +20 -8
- package/filter/filter.so.js.map +1 -1
- package/flp/flp.types.d.ts +6 -1
- package/flp/index.d.ts +0 -1
- package/flp/index.js +0 -1
- package/flpTaskCatalog/CatalogFolderPermissionsRepository.d.ts +17 -0
- package/flpTaskCatalog/CatalogFolderPermissionsRepository.js +34 -0
- package/flpTaskCatalog/CatalogFolderPermissionsRepository.js.map +1 -0
- package/flpTaskCatalog/PostLoadFolderAccessListFilter.d.ts +24 -0
- package/flpTaskCatalog/PostLoadFolderAccessListFilter.js +63 -0
- package/flpTaskCatalog/PostLoadFolderAccessListFilter.js.map +1 -0
- package/flpTaskCatalog/TaskCatalogFlpFeature.d.ts +12 -0
- package/flpTaskCatalog/TaskCatalogFlpFeature.js +49 -0
- package/flpTaskCatalog/TaskCatalogFlpFeature.js.map +1 -0
- package/flpTaskCatalog/TaskFolderCatalogSync.d.ts +29 -0
- package/flpTaskCatalog/TaskFolderCatalogSync.js +57 -0
- package/flpTaskCatalog/TaskFolderCatalogSync.js.map +1 -0
- package/{flp → flpTaskCatalog}/flp.crud.d.ts +1 -1
- package/flpTaskCatalog/flp.crud.js.map +1 -0
- package/flpTaskCatalog/index.d.ts +1 -0
- package/flpTaskCatalog/index.js +1 -0
- package/{utils/decorators → flpTaskCatalog/listEntries}/ListEntriesFactory.d.ts +1 -1
- package/flpTaskCatalog/listEntries/ListEntriesFactory.js.map +1 -0
- package/flpTaskCatalog/listEntries/hasRootFolderId.js.map +1 -0
- package/{utils/decorators → flpTaskCatalog/listEntries}/isPageModel.js +1 -1
- package/flpTaskCatalog/listEntries/isPageModel.js.map +1 -0
- package/flpTaskCatalog/tasks/createFlp.task.d.ts +25 -0
- package/{flp → flpTaskCatalog}/tasks/createFlp.task.js +34 -17
- package/flpTaskCatalog/tasks/createFlp.task.js.map +1 -0
- package/flpTaskCatalog/tasks/deleteFlp.task.d.ts +23 -0
- package/{flp → flpTaskCatalog}/tasks/deleteFlp.task.js +24 -15
- package/flpTaskCatalog/tasks/deleteFlp.task.js.map +1 -0
- package/{flp → flpTaskCatalog}/tasks/syncFlp.task.d.ts +11 -6
- package/{flp → flpTaskCatalog}/tasks/syncFlp.task.js +25 -16
- package/flpTaskCatalog/tasks/syncFlp.task.js.map +1 -0
- package/flpTaskCatalog/tasks/updateFlp.task.d.ts +25 -0
- package/flpTaskCatalog/tasks/updateFlp.task.js +64 -0
- package/flpTaskCatalog/tasks/updateFlp.task.js.map +1 -0
- package/flpTaskCatalog/useCases/CreateFlpUseCase.d.ts +8 -0
- package/{features/flp/CreateFlp → flpTaskCatalog/useCases}/CreateFlpUseCase.js +1 -1
- package/flpTaskCatalog/useCases/CreateFlpUseCase.js.map +1 -0
- package/flpTaskCatalog/useCases/DeleteFlpUseCase.d.ts +8 -0
- package/flpTaskCatalog/useCases/DeleteFlpUseCase.js.map +1 -0
- package/{features/flp/UpdateFlp → flpTaskCatalog/useCases}/UpdateFlpUseCase.d.ts +8 -9
- package/{features/flp/UpdateFlp → flpTaskCatalog/useCases}/UpdateFlpUseCase.js +23 -30
- package/flpTaskCatalog/useCases/UpdateFlpUseCase.js.map +1 -0
- package/folder/createFolderTypeDefs.js +4 -1
- package/folder/createFolderTypeDefs.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +22 -22
- package/types.d.ts +2 -3
- package/types.js.map +1 -1
- package/utils/createOperationsWrapper.d.ts +2 -2
- package/utils/createOperationsWrapper.js +5 -5
- package/utils/createOperationsWrapper.js.map +1 -1
- package/features/flp/CreateFlp/CreateFlpUseCase.d.ts +0 -8
- package/features/flp/CreateFlp/CreateFlpUseCase.js.map +0 -1
- package/features/flp/CreateFlp/feature.d.ts +0 -5
- package/features/flp/CreateFlp/feature.js +0 -13
- package/features/flp/CreateFlp/feature.js.map +0 -1
- package/features/flp/CreateFlpOnFolderCreated/CreateFlpOnFolderCreatedHandler.d.ts +0 -14
- package/features/flp/CreateFlpOnFolderCreated/CreateFlpOnFolderCreatedHandler.js +0 -37
- package/features/flp/CreateFlpOnFolderCreated/CreateFlpOnFolderCreatedHandler.js.map +0 -1
- package/features/flp/CreateFlpOnFolderCreated/feature.js +0 -11
- package/features/flp/CreateFlpOnFolderCreated/feature.js.map +0 -1
- package/features/flp/CreateFlpOnFolderCreated/index.d.ts +0 -1
- package/features/flp/CreateFlpOnFolderCreated/index.js +0 -1
- package/features/flp/DeleteFlp/DeleteFlpUseCase.d.ts +0 -8
- package/features/flp/DeleteFlp/DeleteFlpUseCase.js.map +0 -1
- package/features/flp/DeleteFlp/feature.d.ts +0 -5
- package/features/flp/DeleteFlp/feature.js +0 -13
- package/features/flp/DeleteFlp/feature.js.map +0 -1
- package/features/flp/DeleteFlpOnFolderDeleted/DeleteFlpOnFolderDeletedHandler.js +0 -37
- package/features/flp/DeleteFlpOnFolderDeleted/DeleteFlpOnFolderDeletedHandler.js.map +0 -1
- package/features/flp/DeleteFlpOnFolderDeleted/feature.d.ts +0 -4
- package/features/flp/DeleteFlpOnFolderDeleted/feature.js +0 -11
- package/features/flp/DeleteFlpOnFolderDeleted/feature.js.map +0 -1
- package/features/flp/DeleteFlpOnFolderDeleted/index.d.ts +0 -1
- package/features/flp/DeleteFlpOnFolderDeleted/index.js +0 -1
- package/features/flp/UpdateFlp/UpdateFlpUseCase.js.map +0 -1
- package/features/flp/UpdateFlp/feature.d.ts +0 -5
- package/features/flp/UpdateFlp/feature.js +0 -17
- package/features/flp/UpdateFlp/feature.js.map +0 -1
- package/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.d.ts +0 -14
- package/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.js +0 -39
- package/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.js.map +0 -1
- package/features/flp/UpdateFlpOnFolderUpdated/feature.d.ts +0 -4
- package/features/flp/UpdateFlpOnFolderUpdated/feature.js +0 -11
- package/features/flp/UpdateFlpOnFolderUpdated/feature.js.map +0 -1
- package/features/flp/UpdateFlpOnFolderUpdated/index.d.ts +0 -1
- package/features/flp/UpdateFlpOnFolderUpdated/index.js +0 -1
- package/flp/flp.crud.js.map +0 -1
- package/flp/tasks/createFlp.task.d.ts +0 -18
- package/flp/tasks/createFlp.task.js.map +0 -1
- package/flp/tasks/deleteFlp.task.d.ts +0 -18
- package/flp/tasks/deleteFlp.task.js.map +0 -1
- package/flp/tasks/syncFlp.task.js.map +0 -1
- package/flp/tasks/updateFlp.task.d.ts +0 -18
- package/flp/tasks/updateFlp.task.js +0 -43
- package/flp/tasks/updateFlp.task.js.map +0 -1
- package/utils/decorators/CmsEntriesCrudDecorators.d.ts +0 -11
- package/utils/decorators/CmsEntriesCrudDecorators.js +0 -179
- package/utils/decorators/CmsEntriesCrudDecorators.js.map +0 -1
- package/utils/decorators/FilterEntriesByFolderFactory.d.ts +0 -7
- package/utils/decorators/FilterEntriesByFolderFactory.js +0 -22
- package/utils/decorators/FilterEntriesByFolderFactory.js.map +0 -1
- package/utils/decorators/ListEntriesFactory.js.map +0 -1
- package/utils/decorators/hasRootFolderId.js.map +0 -1
- package/utils/decorators/isPageModel.js.map +0 -1
- /package/{flp → flpTaskCatalog}/flp.crud.js +0 -0
- /package/{utils/decorators → flpTaskCatalog/listEntries}/ListEntriesFactory.js +0 -0
- /package/{utils/decorators → flpTaskCatalog/listEntries}/hasRootFolderId.d.ts +0 -0
- /package/{utils/decorators → flpTaskCatalog/listEntries}/hasRootFolderId.js +0 -0
- /package/{utils/decorators → flpTaskCatalog/listEntries}/isPageModel.d.ts +0 -0
- /package/{features/flp/DeleteFlp → flpTaskCatalog/useCases}/DeleteFlpUseCase.js +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { GetFlpUseCase } from "../abstractions.js";
|
|
2
|
+
import { CodeFlpMerger, CodeFlpsProvider } from "../../shared/index.js";
|
|
3
|
+
class GetFlpWithCodeFlpsImpl {
|
|
4
|
+
constructor(codeFlpsProvider, decoratee){
|
|
5
|
+
this.codeFlpsProvider = codeFlpsProvider;
|
|
6
|
+
this.decoratee = decoratee;
|
|
7
|
+
}
|
|
8
|
+
async execute(id) {
|
|
9
|
+
const flp = await this.decoratee.execute(id);
|
|
10
|
+
if (!flp) return null;
|
|
11
|
+
const codePermissions = await this.codeFlpsProvider.getPermissions({
|
|
12
|
+
type: flp.type,
|
|
13
|
+
path: flp.path
|
|
14
|
+
});
|
|
15
|
+
return CodeFlpMerger.merge(flp, codePermissions);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const GetFlpWithCodeFlps = GetFlpUseCase.createDecorator({
|
|
19
|
+
decorator: GetFlpWithCodeFlpsImpl,
|
|
20
|
+
dependencies: [
|
|
21
|
+
CodeFlpsProvider
|
|
22
|
+
]
|
|
23
|
+
});
|
|
24
|
+
export { GetFlpWithCodeFlps };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=GetFlpWithCodeFlps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/flp/GetFlp/decorators/GetFlpWithCodeFlps.js","sources":["../../../../../src/features/flp/GetFlp/decorators/GetFlpWithCodeFlps.ts"],"sourcesContent":["import { GetFlpUseCase } from \"../abstractions.js\";\nimport { CodeFlpMerger, CodeFlpsProvider } from \"~/features/flp/shared/index.js\";\nimport type { FolderLevelPermission } from \"~/flp/flp.types.js\";\n\nclass GetFlpWithCodeFlpsImpl implements GetFlpUseCase.Interface {\n constructor(\n private codeFlpsProvider: CodeFlpsProvider.Interface,\n private decoratee: GetFlpUseCase.Interface\n ) {}\n\n async execute(id: string): Promise<FolderLevelPermission | null> {\n const flp = await this.decoratee.execute(id);\n\n if (!flp) {\n return null;\n }\n\n const codePermissions = await this.codeFlpsProvider.getPermissions({\n type: flp.type,\n path: flp.path\n });\n\n return CodeFlpMerger.merge(flp, codePermissions);\n }\n}\n\nexport const GetFlpWithCodeFlps = GetFlpUseCase.createDecorator({\n decorator: GetFlpWithCodeFlpsImpl,\n dependencies: [CodeFlpsProvider]\n});\n"],"names":["GetFlpWithCodeFlpsImpl","codeFlpsProvider","decoratee","id","flp","codePermissions","CodeFlpMerger","GetFlpWithCodeFlps","GetFlpUseCase","CodeFlpsProvider"],"mappings":";;AAIA,MAAMA;IACF,YACYC,gBAA4C,EAC5CC,SAAkC,CAC5C;aAFUD,gBAAgB,GAAhBA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQC,EAAU,EAAyC;QAC7D,MAAMC,MAAM,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAACD;QAEzC,IAAI,CAACC,KACD,OAAO;QAGX,MAAMC,kBAAkB,MAAM,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC;YAC/D,MAAMD,IAAI,IAAI;YACd,MAAMA,IAAI,IAAI;QAClB;QAEA,OAAOE,cAAc,KAAK,CAACF,KAAKC;IACpC;AACJ;AAEO,MAAME,qBAAqBC,cAAc,eAAe,CAAC;IAC5D,WAAWR;IACX,cAAc;QAACS;KAAiB;AACpC"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { createFeature } from "@webiny/feature/api";
|
|
2
2
|
import { GetFlpUseCase } from "./GetFlpUseCase.js";
|
|
3
|
-
import { GetFlpUseCase as external_abstractions_js_GetFlpUseCase } from "./abstractions.js";
|
|
4
|
-
import { AcoFlpCrud } from "../../folder/shared/abstractions.js";
|
|
5
3
|
const GetFlpFeature = createFeature({
|
|
6
4
|
name: "GetFlpFeature",
|
|
7
5
|
register (container) {
|
|
8
|
-
container.
|
|
6
|
+
container.register(GetFlpUseCase);
|
|
9
7
|
}
|
|
10
8
|
});
|
|
11
9
|
export { GetFlpFeature };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/flp/GetFlp/feature.js","sources":["../../../../src/features/flp/GetFlp/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { GetFlpUseCase } from \"./GetFlpUseCase.js\";\
|
|
1
|
+
{"version":3,"file":"features/flp/GetFlp/feature.js","sources":["../../../../src/features/flp/GetFlp/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { GetFlpUseCase } from \"./GetFlpUseCase.js\";\n\nexport const GetFlpFeature = createFeature({\n name: \"GetFlpFeature\",\n register(container) {\n container.register(GetFlpUseCase);\n }\n});\n"],"names":["GetFlpFeature","createFeature","container","GetFlpUseCase"],"mappings":";;AAGO,MAAMA,gBAAgBC,cAAc;IACvC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ListFlpsUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
2
|
+
import { FolderPermissionsRepository } from "../../../features/flp/FolderPermissionsRepository/index.js";
|
|
3
|
+
import type { FolderLevelPermission } from "../../../flp/flp.types.js";
|
|
4
|
+
declare class ListFlpsUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
5
|
+
private repository;
|
|
6
|
+
constructor(repository: FolderPermissionsRepository.Interface);
|
|
7
|
+
execute(params: UseCaseAbstraction.Params): Promise<FolderLevelPermission[]>;
|
|
7
8
|
}
|
|
9
|
+
export declare const ListFlpsUseCase: typeof ListFlpsUseCaseImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListFlps>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { ListFlpsUseCase } from "./abstractions.js";
|
|
2
|
+
import { FolderPermissionsRepository } from "../FolderPermissionsRepository/index.js";
|
|
3
|
+
class ListFlpsUseCaseImpl {
|
|
4
|
+
constructor(repository){
|
|
5
|
+
this.repository = repository;
|
|
4
6
|
}
|
|
5
7
|
async execute(params) {
|
|
6
|
-
return this.list(params);
|
|
8
|
+
return this.repository.list(params);
|
|
7
9
|
}
|
|
8
10
|
}
|
|
9
|
-
|
|
11
|
+
const ListFlpsUseCase_ListFlpsUseCase = ListFlpsUseCase.createImplementation({
|
|
12
|
+
implementation: ListFlpsUseCaseImpl,
|
|
13
|
+
dependencies: [
|
|
14
|
+
FolderPermissionsRepository
|
|
15
|
+
]
|
|
16
|
+
});
|
|
17
|
+
export { ListFlpsUseCase_ListFlpsUseCase as ListFlpsUseCase };
|
|
10
18
|
|
|
11
19
|
//# sourceMappingURL=ListFlpsUseCase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/flp/ListFlps/ListFlpsUseCase.js","sources":["../../../../src/features/flp/ListFlps/ListFlpsUseCase.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"features/flp/ListFlps/ListFlpsUseCase.js","sources":["../../../../src/features/flp/ListFlps/ListFlpsUseCase.ts"],"sourcesContent":["import { ListFlpsUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { FolderPermissionsRepository } from \"~/features/flp/FolderPermissionsRepository/index.js\";\nimport type { FolderLevelPermission } from \"~/flp/flp.types.js\";\n\nclass ListFlpsUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(private repository: FolderPermissionsRepository.Interface) {}\n\n async execute(params: UseCaseAbstraction.Params): Promise<FolderLevelPermission[]> {\n return this.repository.list(params);\n }\n}\n\nexport const ListFlpsUseCase = UseCaseAbstraction.createImplementation({\n implementation: ListFlpsUseCaseImpl,\n dependencies: [FolderPermissionsRepository]\n});\n"],"names":["ListFlpsUseCaseImpl","repository","params","ListFlpsUseCase","UseCaseAbstraction","FolderPermissionsRepository"],"mappings":";;AAIA,MAAMA;IACF,YAAoBC,UAAiD,CAAE;aAAnDA,UAAU,GAAVA;IAAoD;IAExE,MAAM,QAAQC,MAAiC,EAAoC;QAC/E,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAACA;IAChC;AACJ;AAEO,MAAMC,kCAAkBC,gBAAAA,oBAAuC,CAAC;IACnE,gBAAgBJ;IAChB,cAAc;QAACK;KAA4B;AAC/C"}
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import type { FolderLevelPermission } from "../../../types.js";
|
|
2
|
-
|
|
3
|
-
where: {
|
|
4
|
-
path_startsWith?: string;
|
|
5
|
-
parentId?: string;
|
|
6
|
-
type: string;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
2
|
+
import type { ListFolderPermissionsParams } from "../../../features/flp/FolderPermissionsRepository/abstractions.js";
|
|
9
3
|
export interface IListFlps {
|
|
10
|
-
execute: (params:
|
|
4
|
+
execute: (params: ListFolderPermissionsParams) => Promise<FolderLevelPermission[]>;
|
|
11
5
|
}
|
|
12
6
|
/** List folder-level permissions. */
|
|
13
7
|
export declare const ListFlpsUseCase: import("@webiny/di").Abstraction<IListFlps>;
|
|
14
8
|
export declare namespace ListFlpsUseCase {
|
|
15
9
|
type Interface = IListFlps;
|
|
10
|
+
type Params = ListFolderPermissionsParams;
|
|
16
11
|
}
|
|
17
|
-
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/flp/ListFlps/abstractions.js","sources":["../../../../src/features/flp/ListFlps/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { FolderLevelPermission } from \"~/types.js\";\
|
|
1
|
+
{"version":3,"file":"features/flp/ListFlps/abstractions.js","sources":["../../../../src/features/flp/ListFlps/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { FolderLevelPermission } from \"~/types.js\";\nimport type { ListFolderPermissionsParams } from \"~/features/flp/FolderPermissionsRepository/abstractions.js\";\n\nexport interface IListFlps {\n execute: (params: ListFolderPermissionsParams) => Promise<FolderLevelPermission[]>;\n}\n\n/** List folder-level permissions. */\nexport const ListFlpsUseCase = createAbstraction<IListFlps>(\"ListFlpsUseCase\");\n\nexport namespace ListFlpsUseCase {\n export type Interface = IListFlps;\n export type Params = ListFolderPermissionsParams;\n}\n"],"names":["ListFlpsUseCase","createAbstraction"],"mappings":";AASO,MAAMA,kBAAkBC,kBAA6B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ListFlpsUseCase } from "../abstractions.js";
|
|
2
|
+
import { CodeFlpsProvider } from "../../../../features/flp/shared/index.js";
|
|
3
|
+
import type { FolderLevelPermission } from "../../../../flp/flp.types.js";
|
|
4
|
+
declare class ListFlpsWithCodeFlpsImpl implements ListFlpsUseCase.Interface {
|
|
5
|
+
private codeFlpsProvider;
|
|
6
|
+
private decoratee;
|
|
7
|
+
constructor(codeFlpsProvider: CodeFlpsProvider.Interface, decoratee: ListFlpsUseCase.Interface);
|
|
8
|
+
execute(params: ListFlpsUseCase.Params): Promise<FolderLevelPermission[]>;
|
|
9
|
+
}
|
|
10
|
+
export declare const ListFlpsWithCodeFlps: typeof ListFlpsWithCodeFlpsImpl & {
|
|
11
|
+
__abstraction: import("@webiny/di").Abstraction<import("../abstractions.js").IListFlps>;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ListFlpsUseCase } from "../abstractions.js";
|
|
2
|
+
import { CodeFlpMerger, CodeFlpsProvider } from "../../shared/index.js";
|
|
3
|
+
class ListFlpsWithCodeFlpsImpl {
|
|
4
|
+
constructor(codeFlpsProvider, decoratee){
|
|
5
|
+
this.codeFlpsProvider = codeFlpsProvider;
|
|
6
|
+
this.decoratee = decoratee;
|
|
7
|
+
}
|
|
8
|
+
async execute(params) {
|
|
9
|
+
const flps = await this.decoratee.execute(params);
|
|
10
|
+
return Promise.all(flps.map(async (flp)=>{
|
|
11
|
+
const codePermissions = await this.codeFlpsProvider.getPermissions({
|
|
12
|
+
type: flp.type,
|
|
13
|
+
path: flp.path
|
|
14
|
+
});
|
|
15
|
+
return CodeFlpMerger.merge(flp, codePermissions);
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const ListFlpsWithCodeFlps = ListFlpsUseCase.createDecorator({
|
|
20
|
+
decorator: ListFlpsWithCodeFlpsImpl,
|
|
21
|
+
dependencies: [
|
|
22
|
+
CodeFlpsProvider
|
|
23
|
+
]
|
|
24
|
+
});
|
|
25
|
+
export { ListFlpsWithCodeFlps };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=ListFlpsWithCodeFlps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/flp/ListFlps/decorators/ListFlpsWithCodeFlps.js","sources":["../../../../../src/features/flp/ListFlps/decorators/ListFlpsWithCodeFlps.ts"],"sourcesContent":["import { ListFlpsUseCase } from \"../abstractions.js\";\nimport { CodeFlpMerger, CodeFlpsProvider } from \"~/features/flp/shared/index.js\";\nimport type { FolderLevelPermission } from \"~/flp/flp.types.js\";\n\nclass ListFlpsWithCodeFlpsImpl implements ListFlpsUseCase.Interface {\n constructor(\n private codeFlpsProvider: CodeFlpsProvider.Interface,\n private decoratee: ListFlpsUseCase.Interface\n ) {}\n\n async execute(params: ListFlpsUseCase.Params): Promise<FolderLevelPermission[]> {\n const flps = await this.decoratee.execute(params);\n\n return Promise.all(\n flps.map(async flp => {\n const codePermissions = await this.codeFlpsProvider.getPermissions({\n type: flp.type,\n path: flp.path\n });\n\n return CodeFlpMerger.merge(flp, codePermissions);\n })\n );\n }\n}\n\nexport const ListFlpsWithCodeFlps = ListFlpsUseCase.createDecorator({\n decorator: ListFlpsWithCodeFlpsImpl,\n dependencies: [CodeFlpsProvider]\n});\n"],"names":["ListFlpsWithCodeFlpsImpl","codeFlpsProvider","decoratee","params","flps","Promise","flp","codePermissions","CodeFlpMerger","ListFlpsWithCodeFlps","ListFlpsUseCase","CodeFlpsProvider"],"mappings":";;AAIA,MAAMA;IACF,YACYC,gBAA4C,EAC5CC,SAAoC,CAC9C;aAFUD,gBAAgB,GAAhBA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQC,MAA8B,EAAoC;QAC5E,MAAMC,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAACD;QAE1C,OAAOE,QAAQ,GAAG,CACdD,KAAK,GAAG,CAAC,OAAME;YACX,MAAMC,kBAAkB,MAAM,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC;gBAC/D,MAAMD,IAAI,IAAI;gBACd,MAAMA,IAAI,IAAI;YAClB;YAEA,OAAOE,cAAc,KAAK,CAACF,KAAKC;QACpC;IAER;AACJ;AAEO,MAAME,uBAAuBC,gBAAgB,eAAe,CAAC;IAChE,WAAWV;IACX,cAAc;QAACW;KAAiB;AACpC"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { createFeature } from "@webiny/feature/api";
|
|
2
2
|
import { ListFlpsUseCase } from "./ListFlpsUseCase.js";
|
|
3
|
-
import { ListFlpsUseCase as external_abstractions_js_ListFlpsUseCase } from "./abstractions.js";
|
|
4
|
-
import { AcoFlpCrud } from "../../folder/shared/abstractions.js";
|
|
5
3
|
const ListFlpsFeature = createFeature({
|
|
6
4
|
name: "ListFlpsFeature",
|
|
7
5
|
register (container) {
|
|
8
|
-
container.
|
|
6
|
+
container.register(ListFlpsUseCase);
|
|
9
7
|
}
|
|
10
8
|
});
|
|
11
9
|
export { ListFlpsFeature };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/flp/ListFlps/feature.js","sources":["../../../../src/features/flp/ListFlps/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { ListFlpsUseCase } from \"./ListFlpsUseCase.js\";\
|
|
1
|
+
{"version":3,"file":"features/flp/ListFlps/feature.js","sources":["../../../../src/features/flp/ListFlps/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { ListFlpsUseCase } from \"./ListFlpsUseCase.js\";\n\nexport const ListFlpsFeature = createFeature({\n name: \"ListFlpsFeature\",\n register(container) {\n container.register(ListFlpsUseCase);\n }\n});\n"],"names":["ListFlpsFeature","createFeature","container","ListFlpsUseCase"],"mappings":";;AAGO,MAAMA,kBAAkBC,cAAc;IACzC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GetLatestRevisionByEntryIdUseCase } from "@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js";
|
|
2
|
+
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
|
|
3
|
+
import { GetUserEntryAccessUseCase as UseCaseAbstraction, GetUserFolderAccessUseCase } from "./abstractions.js";
|
|
4
|
+
declare class GetUserEntryAccessUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
5
|
+
private identityContext;
|
|
6
|
+
private getLatestRevision;
|
|
7
|
+
private getUserFolderAccess;
|
|
8
|
+
constructor(identityContext: IdentityContext.Interface, getLatestRevision: GetLatestRevisionByEntryIdUseCase.Interface, getUserFolderAccess: GetUserFolderAccessUseCase.Interface);
|
|
9
|
+
execute({ userId, model, entryId }: UseCaseAbstraction.Params): UseCaseAbstraction.Return;
|
|
10
|
+
}
|
|
11
|
+
export declare const GetUserEntryAccessUseCase: typeof GetUserEntryAccessUseCaseImpl & {
|
|
12
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGetUserEntryAccessUseCase>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { GetLatestRevisionByEntryIdUseCase } from "@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js";
|
|
3
|
+
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
|
|
4
|
+
import { NotAuthorizedError } from "@webiny/api-core/features/security/shared/errors.js";
|
|
5
|
+
import { GetUserEntryAccessUseCase, GetUserFolderAccessUseCase } from "./abstractions.js";
|
|
6
|
+
import { mayAskAboutUser } from "./mayAskAboutUser.js";
|
|
7
|
+
class GetUserEntryAccessUseCaseImpl {
|
|
8
|
+
constructor(identityContext, getLatestRevision, getUserFolderAccess){
|
|
9
|
+
this.identityContext = identityContext;
|
|
10
|
+
this.getLatestRevision = getLatestRevision;
|
|
11
|
+
this.getUserFolderAccess = getUserFolderAccess;
|
|
12
|
+
}
|
|
13
|
+
async execute({ userId, model, entryId }) {
|
|
14
|
+
if (!await mayAskAboutUser(this.identityContext, userId)) return Result.fail(new NotAuthorizedError());
|
|
15
|
+
const result = await this.identityContext.withoutAuthorization(()=>this.getLatestRevision.execute(model, {
|
|
16
|
+
id: entryId
|
|
17
|
+
}));
|
|
18
|
+
if (result.isFail()) return Result.fail(result.error);
|
|
19
|
+
const folderId = result.value.location?.folderId ?? null;
|
|
20
|
+
return this.getUserFolderAccess.execute({
|
|
21
|
+
userId,
|
|
22
|
+
folderId
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const GetUserEntryAccessUseCase_GetUserEntryAccessUseCase = GetUserEntryAccessUseCase.createImplementation({
|
|
27
|
+
implementation: GetUserEntryAccessUseCaseImpl,
|
|
28
|
+
dependencies: [
|
|
29
|
+
IdentityContext,
|
|
30
|
+
GetLatestRevisionByEntryIdUseCase,
|
|
31
|
+
GetUserFolderAccessUseCase
|
|
32
|
+
]
|
|
33
|
+
});
|
|
34
|
+
export { GetUserEntryAccessUseCase_GetUserEntryAccessUseCase as GetUserEntryAccessUseCase };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=GetUserEntryAccessUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/flp/ListFolderAccess/GetUserEntryAccessUseCase.js","sources":["../../../../src/features/flp/ListFolderAccess/GetUserEntryAccessUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { GetLatestRevisionByEntryIdUseCase } from \"@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport { NotAuthorizedError } from \"@webiny/api-core/features/security/shared/errors.js\";\nimport {\n GetUserEntryAccessUseCase as UseCaseAbstraction,\n GetUserFolderAccessUseCase\n} from \"./abstractions.js\";\nimport { mayAskAboutUser } from \"./mayAskAboutUser.js\";\n\nclass GetUserEntryAccessUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private getLatestRevision: GetLatestRevisionByEntryIdUseCase.Interface,\n private getUserFolderAccess: GetUserFolderAccessUseCase.Interface\n ) {}\n\n async execute({\n userId,\n model,\n entryId\n }: UseCaseAbstraction.Params): UseCaseAbstraction.Return {\n // Checked before reading the entry, so a refused caller learns nothing about it.\n if (!(await mayAskAboutUser(this.identityContext, userId))) {\n return Result.fail(new NotAuthorizedError());\n }\n // The entry is read whoever asks: the answer is about the user, not the caller.\n const result = await this.identityContext.withoutAuthorization(() =>\n this.getLatestRevision.execute(model, { id: entryId })\n );\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n const folderId = result.value.location?.folderId ?? null;\n return this.getUserFolderAccess.execute({ userId, folderId });\n }\n}\n\nexport const GetUserEntryAccessUseCase = UseCaseAbstraction.createImplementation({\n implementation: GetUserEntryAccessUseCaseImpl,\n dependencies: [IdentityContext, GetLatestRevisionByEntryIdUseCase, GetUserFolderAccessUseCase]\n});\n"],"names":["GetUserEntryAccessUseCaseImpl","identityContext","getLatestRevision","getUserFolderAccess","userId","model","entryId","mayAskAboutUser","Result","NotAuthorizedError","result","folderId","GetUserEntryAccessUseCase","UseCaseAbstraction","IdentityContext","GetLatestRevisionByEntryIdUseCase","GetUserFolderAccessUseCase"],"mappings":";;;;;;AAUA,MAAMA;IACF,YACYC,eAA0C,EAC1CC,iBAA8D,EAC9DC,mBAAyD,CACnE;aAHUF,eAAe,GAAfA;aACAC,iBAAiB,GAAjBA;aACAC,mBAAmB,GAAnBA;IACT;IAEH,MAAM,QAAQ,EACVC,MAAM,EACNC,KAAK,EACLC,OAAO,EACiB,EAA6B;QAErD,IAAI,CAAE,MAAMC,gBAAgB,IAAI,CAAC,eAAe,EAAEH,SAC9C,OAAOI,OAAO,IAAI,CAAC,IAAIC;QAG3B,MAAMC,SAAS,MAAM,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAAC,IAC3D,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAACL,OAAO;gBAAE,IAAIC;YAAQ;QAExD,IAAII,OAAO,MAAM,IACb,OAAOF,OAAO,IAAI,CAACE,OAAO,KAAK;QAEnC,MAAMC,WAAWD,OAAO,KAAK,CAAC,QAAQ,EAAE,YAAY;QACpD,OAAO,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC;YAAEN;YAAQO;QAAS;IAC/D;AACJ;AAEO,MAAMC,sDAA4BC,0BAAAA,oBAAuC,CAAC;IAC7E,gBAAgBb;IAChB,cAAc;QAACc;QAAiBC;QAAmCC;KAA2B;AAClG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FeatureFlags } from "@webiny/api-core/features/featureFlags/abstractions.js";
|
|
2
|
+
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
|
|
3
|
+
import { GetUserUseCase } from "@webiny/api-core/features/users/GetUser/index.js";
|
|
4
|
+
import { ListTeamsUseCase } from "@webiny/api-core/features/security/teams/ListTeams/index.js";
|
|
5
|
+
import { ListRolesUseCase } from "@webiny/api-core/features/security/roles/ListRoles/index.js";
|
|
6
|
+
import { GetUserFolderAccessUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
7
|
+
import { GetFlpUseCase } from "../../../features/flp/GetFlp/abstractions.js";
|
|
8
|
+
/**
|
|
9
|
+
* One folder's permissions (`GetFlpUseCase`, inherited and code-defined ones included) checked with
|
|
10
|
+
* one user's level (see `getUserFolderLevel`), as `ListFolderAccessUseCase` does for every user.
|
|
11
|
+
*/
|
|
12
|
+
declare class GetUserFolderAccessUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
13
|
+
private featureFlags;
|
|
14
|
+
private identityContext;
|
|
15
|
+
private getFlp;
|
|
16
|
+
private getUser;
|
|
17
|
+
private listTeams;
|
|
18
|
+
private listRoles;
|
|
19
|
+
constructor(featureFlags: FeatureFlags.Interface, identityContext: IdentityContext.Interface, getFlp: GetFlpUseCase.Interface, getUser: GetUserUseCase.Interface, listTeams: ListTeamsUseCase.Interface, listRoles: ListRolesUseCase.Interface);
|
|
20
|
+
execute({ userId, folderId }: UseCaseAbstraction.Params): UseCaseAbstraction.Return;
|
|
21
|
+
}
|
|
22
|
+
export declare const GetUserFolderAccessUseCase: typeof GetUserFolderAccessUseCaseImpl & {
|
|
23
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGetUserFolderAccessUseCase>;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { FeatureFlags } from "@webiny/api-core/features/featureFlags/abstractions.js";
|
|
3
|
+
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
|
|
4
|
+
import { NotAuthorizedError } from "@webiny/api-core/features/security/shared/errors.js";
|
|
5
|
+
import { GetUserUseCase } from "@webiny/api-core/features/users/GetUser/index.js";
|
|
6
|
+
import { ListTeamsUseCase } from "@webiny/api-core/features/security/teams/ListTeams/index.js";
|
|
7
|
+
import { ListRolesUseCase } from "@webiny/api-core/features/security/roles/ListRoles/index.js";
|
|
8
|
+
import { GetUserFolderAccessUseCase } from "./abstractions.js";
|
|
9
|
+
import { GetFlpUseCase } from "../GetFlp/abstractions.js";
|
|
10
|
+
import { ROOT_FOLDER } from "../../../constants.js";
|
|
11
|
+
import { createAccessDirectory, createUserAccessProfile, getUserFolderLevel } from "./userFolderLevel.js";
|
|
12
|
+
import { mayAskAboutUser } from "./mayAskAboutUser.js";
|
|
13
|
+
class GetUserFolderAccessUseCaseImpl {
|
|
14
|
+
constructor(featureFlags, identityContext, getFlp, getUser, listTeams, listRoles){
|
|
15
|
+
this.featureFlags = featureFlags;
|
|
16
|
+
this.identityContext = identityContext;
|
|
17
|
+
this.getFlp = getFlp;
|
|
18
|
+
this.getUser = getUser;
|
|
19
|
+
this.listTeams = listTeams;
|
|
20
|
+
this.listRoles = listRoles;
|
|
21
|
+
}
|
|
22
|
+
async execute({ userId, folderId }) {
|
|
23
|
+
if (!await mayAskAboutUser(this.identityContext, userId)) return Result.fail(new NotAuthorizedError());
|
|
24
|
+
const unrestricted = Result.ok({
|
|
25
|
+
userId,
|
|
26
|
+
folderId,
|
|
27
|
+
restricted: false,
|
|
28
|
+
canAccess: true
|
|
29
|
+
});
|
|
30
|
+
const flags = this.featureFlags.get();
|
|
31
|
+
if (!folderId || folderId === ROOT_FOLDER || !flags.isEnabled("advancedAccessControlLayer.folderLevelPermissions")) return unrestricted;
|
|
32
|
+
const flp = await this.identityContext.withoutAuthorization(()=>this.getFlp.execute(folderId));
|
|
33
|
+
const permissions = flp?.permissions ?? [];
|
|
34
|
+
if (0 === permissions.length) return unrestricted;
|
|
35
|
+
const teamsEnabled = flags.isEnabled("advancedAccessControlLayer.teams");
|
|
36
|
+
const lookup = await this.identityContext.withoutAuthorization(async ()=>{
|
|
37
|
+
const [user, teams, roles] = await Promise.all([
|
|
38
|
+
this.getUser.execute({
|
|
39
|
+
id: userId
|
|
40
|
+
}),
|
|
41
|
+
teamsEnabled ? this.listTeams.execute() : null,
|
|
42
|
+
this.listRoles.execute()
|
|
43
|
+
]);
|
|
44
|
+
return {
|
|
45
|
+
user,
|
|
46
|
+
teams,
|
|
47
|
+
roles
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
if (lookup.user.isFail()) return Result.fail(lookup.user.error);
|
|
51
|
+
const directory = createAccessDirectory(lookup.teams?.isOk() ? lookup.teams.value : [], lookup.roles.isOk() ? lookup.roles.value : [], teamsEnabled);
|
|
52
|
+
const access = getUserFolderLevel(createUserAccessProfile(lookup.user.value, directory), permissions, teamsEnabled);
|
|
53
|
+
return Result.ok({
|
|
54
|
+
userId,
|
|
55
|
+
folderId,
|
|
56
|
+
restricted: true,
|
|
57
|
+
canAccess: !!access,
|
|
58
|
+
...access ?? {}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const GetUserFolderAccessUseCase_GetUserFolderAccessUseCase = GetUserFolderAccessUseCase.createImplementation({
|
|
63
|
+
implementation: GetUserFolderAccessUseCaseImpl,
|
|
64
|
+
dependencies: [
|
|
65
|
+
FeatureFlags,
|
|
66
|
+
IdentityContext,
|
|
67
|
+
GetFlpUseCase,
|
|
68
|
+
GetUserUseCase,
|
|
69
|
+
ListTeamsUseCase,
|
|
70
|
+
ListRolesUseCase
|
|
71
|
+
]
|
|
72
|
+
});
|
|
73
|
+
export { GetUserFolderAccessUseCase_GetUserFolderAccessUseCase as GetUserFolderAccessUseCase };
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=GetUserFolderAccessUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/flp/ListFolderAccess/GetUserFolderAccessUseCase.js","sources":["../../../../src/features/flp/ListFolderAccess/GetUserFolderAccessUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { FeatureFlags } from \"@webiny/api-core/features/featureFlags/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport { NotAuthorizedError } from \"@webiny/api-core/features/security/shared/errors.js\";\nimport { GetUserUseCase } from \"@webiny/api-core/features/users/GetUser/index.js\";\nimport { ListTeamsUseCase } from \"@webiny/api-core/features/security/teams/ListTeams/index.js\";\nimport { ListRolesUseCase } from \"@webiny/api-core/features/security/roles/ListRoles/index.js\";\nimport { GetUserFolderAccessUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { GetFlpUseCase } from \"~/features/flp/GetFlp/abstractions.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\nimport {\n createAccessDirectory,\n createUserAccessProfile,\n getUserFolderLevel\n} from \"./userFolderLevel.js\";\nimport { mayAskAboutUser } from \"./mayAskAboutUser.js\";\n\n/**\n * One folder's permissions (`GetFlpUseCase`, inherited and code-defined ones included) checked with\n * one user's level (see `getUserFolderLevel`), as `ListFolderAccessUseCase` does for every user.\n */\nclass GetUserFolderAccessUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private featureFlags: FeatureFlags.Interface,\n private identityContext: IdentityContext.Interface,\n private getFlp: GetFlpUseCase.Interface,\n private getUser: GetUserUseCase.Interface,\n private listTeams: ListTeamsUseCase.Interface,\n private listRoles: ListRolesUseCase.Interface\n ) {}\n\n async execute({ userId, folderId }: UseCaseAbstraction.Params): UseCaseAbstraction.Return {\n if (!(await mayAskAboutUser(this.identityContext, userId))) {\n return Result.fail(new NotAuthorizedError());\n }\n\n const unrestricted = Result.ok({ userId, folderId, restricted: false, canAccess: true });\n const flags = this.featureFlags.get();\n if (\n !folderId ||\n folderId === ROOT_FOLDER ||\n !flags.isEnabled(\"advancedAccessControlLayer.folderLevelPermissions\")\n ) {\n return unrestricted;\n }\n\n const flp = await this.identityContext.withoutAuthorization(() =>\n this.getFlp.execute(folderId)\n );\n const permissions = flp?.permissions ?? [];\n if (permissions.length === 0) {\n return unrestricted;\n }\n\n const teamsEnabled = flags.isEnabled(\"advancedAccessControlLayer.teams\");\n const lookup = await this.identityContext.withoutAuthorization(async () => {\n const [user, teams, roles] = await Promise.all([\n this.getUser.execute({ id: userId }),\n teamsEnabled ? this.listTeams.execute() : null,\n this.listRoles.execute()\n ]);\n return { user, teams, roles };\n });\n if (lookup.user.isFail()) {\n return Result.fail(lookup.user.error);\n }\n\n const directory = createAccessDirectory(\n lookup.teams?.isOk() ? lookup.teams.value : [],\n lookup.roles.isOk() ? lookup.roles.value : [],\n teamsEnabled\n );\n const access = getUserFolderLevel(\n createUserAccessProfile(lookup.user.value, directory),\n permissions,\n teamsEnabled\n );\n\n return Result.ok({\n userId,\n folderId,\n restricted: true,\n canAccess: !!access,\n ...(access ?? {})\n });\n }\n}\n\nexport const GetUserFolderAccessUseCase = UseCaseAbstraction.createImplementation({\n implementation: GetUserFolderAccessUseCaseImpl,\n dependencies: [\n FeatureFlags,\n IdentityContext,\n GetFlpUseCase,\n GetUserUseCase,\n ListTeamsUseCase,\n ListRolesUseCase\n ]\n});\n"],"names":["GetUserFolderAccessUseCaseImpl","featureFlags","identityContext","getFlp","getUser","listTeams","listRoles","userId","folderId","mayAskAboutUser","Result","NotAuthorizedError","unrestricted","flags","ROOT_FOLDER","flp","permissions","teamsEnabled","lookup","user","teams","roles","Promise","directory","createAccessDirectory","access","getUserFolderLevel","createUserAccessProfile","GetUserFolderAccessUseCase","UseCaseAbstraction","FeatureFlags","IdentityContext","GetFlpUseCase","GetUserUseCase","ListTeamsUseCase","ListRolesUseCase"],"mappings":";;;;;;;;;;;;AAqBA,MAAMA;IACF,YACYC,YAAoC,EACpCC,eAA0C,EAC1CC,MAA+B,EAC/BC,OAAiC,EACjCC,SAAqC,EACrCC,SAAqC,CAC/C;aANUL,YAAY,GAAZA;aACAC,eAAe,GAAfA;aACAC,MAAM,GAANA;aACAC,OAAO,GAAPA;aACAC,SAAS,GAATA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQ,EAAEC,MAAM,EAAEC,QAAQ,EAA6B,EAA6B;QACtF,IAAI,CAAE,MAAMC,gBAAgB,IAAI,CAAC,eAAe,EAAEF,SAC9C,OAAOG,OAAO,IAAI,CAAC,IAAIC;QAG3B,MAAMC,eAAeF,OAAO,EAAE,CAAC;YAAEH;YAAQC;YAAU,YAAY;YAAO,WAAW;QAAK;QACtF,MAAMK,QAAQ,IAAI,CAAC,YAAY,CAAC,GAAG;QACnC,IACI,CAACL,YACDA,aAAaM,eACb,CAACD,MAAM,SAAS,CAAC,sDAEjB,OAAOD;QAGX,MAAMG,MAAM,MAAM,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAAC,IACxD,IAAI,CAAC,MAAM,CAAC,OAAO,CAACP;QAExB,MAAMQ,cAAcD,KAAK,eAAe,EAAE;QAC1C,IAAIC,AAAuB,MAAvBA,YAAY,MAAM,EAClB,OAAOJ;QAGX,MAAMK,eAAeJ,MAAM,SAAS,CAAC;QACrC,MAAMK,SAAS,MAAM,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAAC;YAC3D,MAAM,CAACC,MAAMC,OAAOC,MAAM,GAAG,MAAMC,QAAQ,GAAG,CAAC;gBAC3C,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;oBAAE,IAAIf;gBAAO;gBAClCU,eAAe,IAAI,CAAC,SAAS,CAAC,OAAO,KAAK;gBAC1C,IAAI,CAAC,SAAS,CAAC,OAAO;aACzB;YACD,OAAO;gBAAEE;gBAAMC;gBAAOC;YAAM;QAChC;QACA,IAAIH,OAAO,IAAI,CAAC,MAAM,IAClB,OAAOR,OAAO,IAAI,CAACQ,OAAO,IAAI,CAAC,KAAK;QAGxC,MAAMK,YAAYC,sBACdN,OAAO,KAAK,EAAE,SAASA,OAAO,KAAK,CAAC,KAAK,GAAG,EAAE,EAC9CA,OAAO,KAAK,CAAC,IAAI,KAAKA,OAAO,KAAK,CAAC,KAAK,GAAG,EAAE,EAC7CD;QAEJ,MAAMQ,SAASC,mBACXC,wBAAwBT,OAAO,IAAI,CAAC,KAAK,EAAEK,YAC3CP,aACAC;QAGJ,OAAOP,OAAO,EAAE,CAAC;YACbH;YACAC;YACA,YAAY;YACZ,WAAW,CAAC,CAACiB;YACb,GAAIA,UAAU,CAAC,CAAC;QACpB;IACJ;AACJ;AAEO,MAAMG,wDAA6BC,2BAAAA,oBAAuC,CAAC;IAC9E,gBAAgB7B;IAChB,cAAc;QACV8B;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { GetLatestRevisionByEntryIdUseCase } from "@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js";
|
|
3
|
+
import { ListEntryAccessUseCase as UseCaseAbstraction, ListFolderAccessUseCase } from "./abstractions.js";
|
|
4
|
+
declare class ListEntryAccessUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
5
|
+
private getLatestRevision;
|
|
6
|
+
private listFolderAccess;
|
|
7
|
+
constructor(getLatestRevision: GetLatestRevisionByEntryIdUseCase.Interface, listFolderAccess: ListFolderAccessUseCase.Interface);
|
|
8
|
+
execute(model: CmsModel, entryId: string): UseCaseAbstraction.Return;
|
|
9
|
+
}
|
|
10
|
+
export declare const ListEntryAccessUseCase: typeof ListEntryAccessUseCaseImpl & {
|
|
11
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListEntryAccessUseCase>;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { GetLatestRevisionByEntryIdUseCase } from "@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js";
|
|
3
|
+
import { ListEntryAccessUseCase, ListFolderAccessUseCase } from "./abstractions.js";
|
|
4
|
+
class ListEntryAccessUseCaseImpl {
|
|
5
|
+
constructor(getLatestRevision, listFolderAccess){
|
|
6
|
+
this.getLatestRevision = getLatestRevision;
|
|
7
|
+
this.listFolderAccess = listFolderAccess;
|
|
8
|
+
}
|
|
9
|
+
async execute(model, entryId) {
|
|
10
|
+
const result = await this.getLatestRevision.execute(model, {
|
|
11
|
+
id: entryId
|
|
12
|
+
});
|
|
13
|
+
if (result.isFail()) return Result.fail(result.error);
|
|
14
|
+
const entry = result.value;
|
|
15
|
+
const folderId = entry.location?.folderId ?? null;
|
|
16
|
+
return this.listFolderAccess.execute(folderId);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const ListEntryAccessUseCase_ListEntryAccessUseCase = ListEntryAccessUseCase.createImplementation({
|
|
20
|
+
implementation: ListEntryAccessUseCaseImpl,
|
|
21
|
+
dependencies: [
|
|
22
|
+
GetLatestRevisionByEntryIdUseCase,
|
|
23
|
+
ListFolderAccessUseCase
|
|
24
|
+
]
|
|
25
|
+
});
|
|
26
|
+
export { ListEntryAccessUseCase_ListEntryAccessUseCase as ListEntryAccessUseCase };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=ListEntryAccessUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/flp/ListFolderAccess/ListEntryAccessUseCase.js","sources":["../../../../src/features/flp/ListFolderAccess/ListEntryAccessUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetLatestRevisionByEntryIdUseCase } from \"@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js\";\nimport {\n ListEntryAccessUseCase as UseCaseAbstraction,\n ListFolderAccessUseCase\n} from \"./abstractions.js\";\n\nclass ListEntryAccessUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private getLatestRevision: GetLatestRevisionByEntryIdUseCase.Interface,\n private listFolderAccess: ListFolderAccessUseCase.Interface\n ) {}\n\n async execute(model: CmsModel, entryId: string): UseCaseAbstraction.Return {\n const result = await this.getLatestRevision.execute(model, { id: entryId });\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n const entry = result.value;\n const folderId = entry.location?.folderId ?? null;\n return this.listFolderAccess.execute(folderId);\n }\n}\n\nexport const ListEntryAccessUseCase = UseCaseAbstraction.createImplementation({\n implementation: ListEntryAccessUseCaseImpl,\n dependencies: [GetLatestRevisionByEntryIdUseCase, ListFolderAccessUseCase]\n});\n"],"names":["ListEntryAccessUseCaseImpl","getLatestRevision","listFolderAccess","model","entryId","result","Result","entry","folderId","ListEntryAccessUseCase","UseCaseAbstraction","GetLatestRevisionByEntryIdUseCase","ListFolderAccessUseCase"],"mappings":";;;AAQA,MAAMA;IACF,YACYC,iBAA8D,EAC9DC,gBAAmD,CAC7D;aAFUD,iBAAiB,GAAjBA;aACAC,gBAAgB,GAAhBA;IACT;IAEH,MAAM,QAAQC,KAAe,EAAEC,OAAe,EAA6B;QACvE,MAAMC,SAAS,MAAM,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAACF,OAAO;YAAE,IAAIC;QAAQ;QACzE,IAAIC,OAAO,MAAM,IACb,OAAOC,OAAO,IAAI,CAACD,OAAO,KAAK;QAEnC,MAAME,QAAQF,OAAO,KAAK;QAC1B,MAAMG,WAAWD,MAAM,QAAQ,EAAE,YAAY;QAC7C,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAACC;IACzC;AACJ;AAEO,MAAMC,gDAAyBC,uBAAAA,oBAAuC,CAAC;IAC1E,gBAAgBV;IAChB,cAAc;QAACW;QAAmCC;KAAwB;AAC9E"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FeatureFlags } from "@webiny/api-core/features/featureFlags/abstractions.js";
|
|
2
|
+
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
|
|
3
|
+
import { ListUsersUseCase } from "@webiny/api-core/features/users/ListUsers/index.js";
|
|
4
|
+
import { ListTeamsUseCase } from "@webiny/api-core/features/security/teams/ListTeams/index.js";
|
|
5
|
+
import { ListRolesUseCase } from "@webiny/api-core/features/security/roles/ListRoles/index.js";
|
|
6
|
+
import { ListFolderAccessUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
7
|
+
import { GetFlpUseCase } from "../../../features/flp/GetFlp/abstractions.js";
|
|
8
|
+
import { FolderLevelPermissions } from "../../../features/flp/FolderLevelPermissions/abstractions.js";
|
|
9
|
+
/** For every admin user, the level they would get on the folder (see `getUserFolderLevel`). */
|
|
10
|
+
declare class ListFolderAccessUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
11
|
+
private featureFlags;
|
|
12
|
+
private identityContext;
|
|
13
|
+
private folderLevelPermissions;
|
|
14
|
+
private getFlp;
|
|
15
|
+
private listUsers;
|
|
16
|
+
private listTeams;
|
|
17
|
+
private listRoles;
|
|
18
|
+
constructor(featureFlags: FeatureFlags.Interface, identityContext: IdentityContext.Interface, folderLevelPermissions: FolderLevelPermissions.Interface, getFlp: GetFlpUseCase.Interface, listUsers: ListUsersUseCase.Interface, listTeams: ListTeamsUseCase.Interface, listRoles: ListRolesUseCase.Interface);
|
|
19
|
+
execute(folderId: string | null): UseCaseAbstraction.Return;
|
|
20
|
+
}
|
|
21
|
+
export declare const ListFolderAccessUseCase: typeof ListFolderAccessUseCaseImpl & {
|
|
22
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListFolderAccessUseCase>;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { FeatureFlags } from "@webiny/api-core/features/featureFlags/abstractions.js";
|
|
3
|
+
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
|
|
4
|
+
import { NotAuthorizedError } from "@webiny/api-core/features/security/shared/errors.js";
|
|
5
|
+
import { ListUsersUseCase } from "@webiny/api-core/features/users/ListUsers/index.js";
|
|
6
|
+
import { ListTeamsUseCase } from "@webiny/api-core/features/security/teams/ListTeams/index.js";
|
|
7
|
+
import { ListRolesUseCase } from "@webiny/api-core/features/security/roles/ListRoles/index.js";
|
|
8
|
+
import { ListFolderAccessUseCase } from "./abstractions.js";
|
|
9
|
+
import { GetFlpUseCase } from "../GetFlp/abstractions.js";
|
|
10
|
+
import { FolderLevelPermissions } from "../FolderLevelPermissions/abstractions.js";
|
|
11
|
+
import { ROOT_FOLDER } from "../../../constants.js";
|
|
12
|
+
import { createAccessDirectory, createUserAccessProfile, getUserFolderLevel } from "./userFolderLevel.js";
|
|
13
|
+
const unrestricted = (folderId)=>({
|
|
14
|
+
folderId,
|
|
15
|
+
restricted: false,
|
|
16
|
+
users: [],
|
|
17
|
+
teams: []
|
|
18
|
+
});
|
|
19
|
+
class ListFolderAccessUseCaseImpl {
|
|
20
|
+
constructor(featureFlags, identityContext, folderLevelPermissions, getFlp, listUsers, listTeams, listRoles){
|
|
21
|
+
this.featureFlags = featureFlags;
|
|
22
|
+
this.identityContext = identityContext;
|
|
23
|
+
this.folderLevelPermissions = folderLevelPermissions;
|
|
24
|
+
this.getFlp = getFlp;
|
|
25
|
+
this.listUsers = listUsers;
|
|
26
|
+
this.listTeams = listTeams;
|
|
27
|
+
this.listRoles = listRoles;
|
|
28
|
+
}
|
|
29
|
+
async execute(folderId) {
|
|
30
|
+
const flags = this.featureFlags.get();
|
|
31
|
+
if (!folderId || folderId === ROOT_FOLDER || !flags.isEnabled("advancedAccessControlLayer.folderLevelPermissions")) return Result.ok(unrestricted(folderId));
|
|
32
|
+
const flp = await this.getFlp.execute(folderId);
|
|
33
|
+
const permissions = flp?.permissions ?? [];
|
|
34
|
+
if (0 === permissions.length) return Result.ok(unrestricted(folderId));
|
|
35
|
+
if (this.identityContext.isAuthorizationEnabled()) {
|
|
36
|
+
const canManage = await this.folderLevelPermissions.canManageFolderPermissions({
|
|
37
|
+
...flp,
|
|
38
|
+
permissions: await this.folderLevelPermissions.getDefaultPermissions(permissions)
|
|
39
|
+
});
|
|
40
|
+
if (!canManage) return Result.fail(new NotAuthorizedError());
|
|
41
|
+
}
|
|
42
|
+
const teamsEnabled = flags.isEnabled("advancedAccessControlLayer.teams");
|
|
43
|
+
const { users, teams, roles } = await this.identityContext.withoutAuthorization(async ()=>{
|
|
44
|
+
const [users, teams, roles] = await Promise.all([
|
|
45
|
+
this.listUsers.execute(),
|
|
46
|
+
this.listTeams.execute(),
|
|
47
|
+
this.listRoles.execute()
|
|
48
|
+
]);
|
|
49
|
+
return {
|
|
50
|
+
users: users.isOk() ? users.value : [],
|
|
51
|
+
teams: teams.isOk() ? teams.value : [],
|
|
52
|
+
roles: roles.isOk() ? roles.value : []
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
const directory = createAccessDirectory(teams, roles, teamsEnabled);
|
|
56
|
+
const teamsBySlug = new Map(teams.map((team)=>[
|
|
57
|
+
team.slug,
|
|
58
|
+
team
|
|
59
|
+
]));
|
|
60
|
+
const accessUsers = [];
|
|
61
|
+
for (const user of users){
|
|
62
|
+
const access = getUserFolderLevel(createUserAccessProfile(user, directory), permissions, teamsEnabled);
|
|
63
|
+
if (access) accessUsers.push({
|
|
64
|
+
id: user.id,
|
|
65
|
+
displayName: user.displayName,
|
|
66
|
+
email: user.email,
|
|
67
|
+
...access
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
const accessTeams = permissions.filter((p)=>p.target.startsWith("team:") && "no-access" !== p.level).map((p)=>{
|
|
71
|
+
const slug = p.target.slice(5);
|
|
72
|
+
const team = teamsBySlug.get(slug);
|
|
73
|
+
return {
|
|
74
|
+
...team ? {
|
|
75
|
+
id: team.id,
|
|
76
|
+
name: team.name
|
|
77
|
+
} : {},
|
|
78
|
+
slug,
|
|
79
|
+
level: p.level,
|
|
80
|
+
...p.inheritedFrom ? {
|
|
81
|
+
inheritedFrom: p.inheritedFrom
|
|
82
|
+
} : {}
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
return Result.ok({
|
|
86
|
+
folderId,
|
|
87
|
+
restricted: true,
|
|
88
|
+
users: accessUsers,
|
|
89
|
+
teams: teamsEnabled ? accessTeams : []
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const ListFolderAccessUseCase_ListFolderAccessUseCase = ListFolderAccessUseCase.createImplementation({
|
|
94
|
+
implementation: ListFolderAccessUseCaseImpl,
|
|
95
|
+
dependencies: [
|
|
96
|
+
FeatureFlags,
|
|
97
|
+
IdentityContext,
|
|
98
|
+
FolderLevelPermissions,
|
|
99
|
+
GetFlpUseCase,
|
|
100
|
+
ListUsersUseCase,
|
|
101
|
+
ListTeamsUseCase,
|
|
102
|
+
ListRolesUseCase
|
|
103
|
+
]
|
|
104
|
+
});
|
|
105
|
+
export { ListFolderAccessUseCase_ListFolderAccessUseCase as ListFolderAccessUseCase };
|
|
106
|
+
|
|
107
|
+
//# sourceMappingURL=ListFolderAccessUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/flp/ListFolderAccess/ListFolderAccessUseCase.js","sources":["../../../../src/features/flp/ListFolderAccess/ListFolderAccessUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { FeatureFlags } from \"@webiny/api-core/features/featureFlags/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport { NotAuthorizedError } from \"@webiny/api-core/features/security/shared/errors.js\";\nimport { ListUsersUseCase } from \"@webiny/api-core/features/users/ListUsers/index.js\";\nimport { ListTeamsUseCase } from \"@webiny/api-core/features/security/teams/ListTeams/index.js\";\nimport { ListRolesUseCase } from \"@webiny/api-core/features/security/roles/ListRoles/index.js\";\nimport type { Team } from \"@webiny/api-core/types/security.js\";\nimport { ListFolderAccessUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport type { FolderAccess, FolderAccessTeam, FolderAccessUser } from \"./abstractions.js\";\nimport { GetFlpUseCase } from \"~/features/flp/GetFlp/abstractions.js\";\nimport { FolderLevelPermissions } from \"~/features/flp/FolderLevelPermissions/abstractions.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\nimport {\n createAccessDirectory,\n createUserAccessProfile,\n getUserFolderLevel\n} from \"./userFolderLevel.js\";\n\nconst unrestricted = (folderId: string | null): FolderAccess => ({\n folderId,\n restricted: false,\n users: [],\n teams: []\n});\n\n/** For every admin user, the level they would get on the folder (see `getUserFolderLevel`). */\nclass ListFolderAccessUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private featureFlags: FeatureFlags.Interface,\n private identityContext: IdentityContext.Interface,\n private folderLevelPermissions: FolderLevelPermissions.Interface,\n private getFlp: GetFlpUseCase.Interface,\n private listUsers: ListUsersUseCase.Interface,\n private listTeams: ListTeamsUseCase.Interface,\n private listRoles: ListRolesUseCase.Interface\n ) {}\n\n async execute(folderId: string | null): UseCaseAbstraction.Return {\n const flags = this.featureFlags.get();\n if (\n !folderId ||\n folderId === ROOT_FOLDER ||\n !flags.isEnabled(\"advancedAccessControlLayer.folderLevelPermissions\")\n ) {\n return Result.ok(unrestricted(folderId));\n }\n\n const flp = await this.getFlp.execute(folderId);\n const permissions = flp?.permissions ?? [];\n if (permissions.length === 0) {\n return Result.ok(unrestricted(folderId));\n }\n\n // Who can access a folder is shown to those who can manage its permissions.\n if (this.identityContext.isAuthorizationEnabled()) {\n const canManage = await this.folderLevelPermissions.canManageFolderPermissions({\n ...flp!,\n permissions: await this.folderLevelPermissions.getDefaultPermissions(permissions)\n });\n if (!canManage) {\n return Result.fail(new NotAuthorizedError());\n }\n }\n\n const teamsEnabled = flags.isEnabled(\"advancedAccessControlLayer.teams\");\n const { users, teams, roles } = await this.identityContext.withoutAuthorization(\n async () => {\n const [users, teams, roles] = await Promise.all([\n this.listUsers.execute(),\n this.listTeams.execute(),\n this.listRoles.execute()\n ]);\n return {\n users: users.isOk() ? users.value : [],\n teams: teams.isOk() ? teams.value : [],\n roles: roles.isOk() ? roles.value : []\n };\n }\n );\n\n const directory = createAccessDirectory(teams, roles, teamsEnabled);\n const teamsBySlug = new Map<string, Team>(teams.map(team => [team.slug, team]));\n\n const accessUsers: FolderAccessUser[] = [];\n for (const user of users) {\n const access = getUserFolderLevel(\n createUserAccessProfile(user, directory),\n permissions,\n teamsEnabled\n );\n if (access) {\n accessUsers.push({\n id: user.id,\n displayName: user.displayName,\n email: user.email,\n ...access\n });\n }\n }\n\n const accessTeams: FolderAccessTeam[] = permissions\n .filter(p => p.target.startsWith(\"team:\") && p.level !== \"no-access\")\n .map(p => {\n const slug = p.target.slice(\"team:\".length);\n const team = teamsBySlug.get(slug);\n return {\n ...(team ? { id: team.id, name: team.name } : {}),\n slug,\n level: p.level,\n ...(p.inheritedFrom ? { inheritedFrom: p.inheritedFrom } : {})\n };\n });\n\n return Result.ok({\n folderId,\n restricted: true,\n users: accessUsers,\n teams: teamsEnabled ? accessTeams : []\n });\n }\n}\n\nexport const ListFolderAccessUseCase = UseCaseAbstraction.createImplementation({\n implementation: ListFolderAccessUseCaseImpl,\n dependencies: [\n FeatureFlags,\n IdentityContext,\n FolderLevelPermissions,\n GetFlpUseCase,\n ListUsersUseCase,\n ListTeamsUseCase,\n ListRolesUseCase\n ]\n});\n"],"names":["unrestricted","folderId","ListFolderAccessUseCaseImpl","featureFlags","identityContext","folderLevelPermissions","getFlp","listUsers","listTeams","listRoles","flags","ROOT_FOLDER","Result","flp","permissions","canManage","NotAuthorizedError","teamsEnabled","users","teams","roles","Promise","directory","createAccessDirectory","teamsBySlug","Map","team","accessUsers","user","access","getUserFolderLevel","createUserAccessProfile","accessTeams","p","slug","ListFolderAccessUseCase","UseCaseAbstraction","FeatureFlags","IdentityContext","FolderLevelPermissions","GetFlpUseCase","ListUsersUseCase","ListTeamsUseCase","ListRolesUseCase"],"mappings":";;;;;;;;;;;;AAmBA,MAAMA,eAAe,CAACC,WAA2C;QAC7DA;QACA,YAAY;QACZ,OAAO,EAAE;QACT,OAAO,EAAE;IACb;AAGA,MAAMC;IACF,YACYC,YAAoC,EACpCC,eAA0C,EAC1CC,sBAAwD,EACxDC,MAA+B,EAC/BC,SAAqC,EACrCC,SAAqC,EACrCC,SAAqC,CAC/C;aAPUN,YAAY,GAAZA;aACAC,eAAe,GAAfA;aACAC,sBAAsB,GAAtBA;aACAC,MAAM,GAANA;aACAC,SAAS,GAATA;aACAC,SAAS,GAATA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQR,QAAuB,EAA6B;QAC9D,MAAMS,QAAQ,IAAI,CAAC,YAAY,CAAC,GAAG;QACnC,IACI,CAACT,YACDA,aAAaU,eACb,CAACD,MAAM,SAAS,CAAC,sDAEjB,OAAOE,OAAO,EAAE,CAACZ,aAAaC;QAGlC,MAAMY,MAAM,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAACZ;QACtC,MAAMa,cAAcD,KAAK,eAAe,EAAE;QAC1C,IAAIC,AAAuB,MAAvBA,YAAY,MAAM,EAClB,OAAOF,OAAO,EAAE,CAACZ,aAAaC;QAIlC,IAAI,IAAI,CAAC,eAAe,CAAC,sBAAsB,IAAI;YAC/C,MAAMc,YAAY,MAAM,IAAI,CAAC,sBAAsB,CAAC,0BAA0B,CAAC;gBAC3E,GAAGF,GAAG;gBACN,aAAa,MAAM,IAAI,CAAC,sBAAsB,CAAC,qBAAqB,CAACC;YACzE;YACA,IAAI,CAACC,WACD,OAAOH,OAAO,IAAI,CAAC,IAAII;QAE/B;QAEA,MAAMC,eAAeP,MAAM,SAAS,CAAC;QACrC,MAAM,EAAEQ,KAAK,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAC3E;YACI,MAAM,CAACF,OAAOC,OAAOC,MAAM,GAAG,MAAMC,QAAQ,GAAG,CAAC;gBAC5C,IAAI,CAAC,SAAS,CAAC,OAAO;gBACtB,IAAI,CAAC,SAAS,CAAC,OAAO;gBACtB,IAAI,CAAC,SAAS,CAAC,OAAO;aACzB;YACD,OAAO;gBACH,OAAOH,MAAM,IAAI,KAAKA,MAAM,KAAK,GAAG,EAAE;gBACtC,OAAOC,MAAM,IAAI,KAAKA,MAAM,KAAK,GAAG,EAAE;gBACtC,OAAOC,MAAM,IAAI,KAAKA,MAAM,KAAK,GAAG,EAAE;YAC1C;QACJ;QAGJ,MAAME,YAAYC,sBAAsBJ,OAAOC,OAAOH;QACtD,MAAMO,cAAc,IAAIC,IAAkBN,MAAM,GAAG,CAACO,CAAAA,OAAQ;gBAACA,KAAK,IAAI;gBAAEA;aAAK;QAE7E,MAAMC,cAAkC,EAAE;QAC1C,KAAK,MAAMC,QAAQV,MAAO;YACtB,MAAMW,SAASC,mBACXC,wBAAwBH,MAAMN,YAC9BR,aACAG;YAEJ,IAAIY,QACAF,YAAY,IAAI,CAAC;gBACb,IAAIC,KAAK,EAAE;gBACX,aAAaA,KAAK,WAAW;gBAC7B,OAAOA,KAAK,KAAK;gBACjB,GAAGC,MAAM;YACb;QAER;QAEA,MAAMG,cAAkClB,YACnC,MAAM,CAACmB,CAAAA,IAAKA,EAAE,MAAM,CAAC,UAAU,CAAC,YAAYA,AAAY,gBAAZA,EAAE,KAAK,EACnD,GAAG,CAACA,CAAAA;YACD,MAAMC,OAAOD,EAAE,MAAM,CAAC,KAAK,CAAC;YAC5B,MAAMP,OAAOF,YAAY,GAAG,CAACU;YAC7B,OAAO;gBACH,GAAIR,OAAO;oBAAE,IAAIA,KAAK,EAAE;oBAAE,MAAMA,KAAK,IAAI;gBAAC,IAAI,CAAC,CAAC;gBAChDQ;gBACA,OAAOD,EAAE,KAAK;gBACd,GAAIA,EAAE,aAAa,GAAG;oBAAE,eAAeA,EAAE,aAAa;gBAAC,IAAI,CAAC,CAAC;YACjE;QACJ;QAEJ,OAAOrB,OAAO,EAAE,CAAC;YACbX;YACA,YAAY;YACZ,OAAO0B;YACP,OAAOV,eAAee,cAAc,EAAE;QAC1C;IACJ;AACJ;AAEO,MAAMG,kDAA0BC,wBAAAA,oBAAuC,CAAC;IAC3E,gBAAgBlC;IAChB,cAAc;QACVmC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
|