@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,19 @@
|
|
|
1
|
+
import { FolderAfterCreateEventHandler } from "../../folder/CreateFolder/abstractions.js";
|
|
2
|
+
import { FolderCatalogSync } from "./abstractions.js";
|
|
3
|
+
class SyncFolderCatalogOnFolderCreatedHandlerImpl {
|
|
4
|
+
constructor(sync){
|
|
5
|
+
this.sync = sync;
|
|
6
|
+
}
|
|
7
|
+
async handle(event) {
|
|
8
|
+
await this.sync.folderCreated(event.payload.folder);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const SyncFolderCatalogOnFolderCreatedHandler = FolderAfterCreateEventHandler.createImplementation({
|
|
12
|
+
implementation: SyncFolderCatalogOnFolderCreatedHandlerImpl,
|
|
13
|
+
dependencies: [
|
|
14
|
+
FolderCatalogSync
|
|
15
|
+
]
|
|
16
|
+
});
|
|
17
|
+
export default SyncFolderCatalogOnFolderCreatedHandler;
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=SyncFolderCatalogOnFolderCreatedHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderCreatedHandler.js","sources":["../../../../src/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderCreatedHandler.ts"],"sourcesContent":["import { FolderAfterCreateEventHandler } from \"~/features/folder/CreateFolder/abstractions.js\";\nimport { FolderCatalogSync } from \"./abstractions.js\";\n\nclass SyncFolderCatalogOnFolderCreatedHandlerImpl\n implements FolderAfterCreateEventHandler.Interface\n{\n constructor(private sync: FolderCatalogSync.Interface) {}\n\n async handle(event: FolderAfterCreateEventHandler.Event): Promise<void> {\n await this.sync.folderCreated(event.payload.folder);\n }\n}\n\nexport default FolderAfterCreateEventHandler.createImplementation({\n implementation: SyncFolderCatalogOnFolderCreatedHandlerImpl,\n dependencies: [FolderCatalogSync]\n});\n"],"names":["SyncFolderCatalogOnFolderCreatedHandlerImpl","sync","event","FolderAfterCreateEventHandler","FolderCatalogSync"],"mappings":";;AAGA,MAAMA;IAGF,YAAoBC,IAAiC,CAAE;aAAnCA,IAAI,GAAJA;IAAoC;IAExD,MAAM,OAAOC,KAA0C,EAAiB;QACpE,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,CAACA,MAAM,OAAO,CAAC,MAAM;IACtD;AACJ;AAEA,gDAAeC,8BAA8B,oBAAoB,CAAC;IAC9D,gBAAgBH;IAChB,cAAc;QAACI;KAAkB;AACrC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FolderAfterDeleteEventHandler } from "../../../features/folder/DeleteFolder/abstractions.js";
|
|
2
|
+
import { FolderCatalogSync } from "./abstractions.js";
|
|
3
|
+
declare class SyncFolderCatalogOnFolderDeletedHandlerImpl implements FolderAfterDeleteEventHandler.Interface {
|
|
4
|
+
private sync;
|
|
5
|
+
constructor(sync: FolderCatalogSync.Interface);
|
|
6
|
+
handle(event: FolderAfterDeleteEventHandler.Event): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: typeof SyncFolderCatalogOnFolderDeletedHandlerImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher/abstractions.js").IEventHandler<import("@webiny/api-core/features/eventPublisher/abstractions.js").DomainEvent<import("~/features/folder/DeleteFolder/abstractions.js").FolderAfterDeletePayload>>>;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FolderAfterDeleteEventHandler } from "../../folder/DeleteFolder/abstractions.js";
|
|
2
|
+
import { FolderCatalogSync } from "./abstractions.js";
|
|
3
|
+
class SyncFolderCatalogOnFolderDeletedHandlerImpl {
|
|
4
|
+
constructor(sync){
|
|
5
|
+
this.sync = sync;
|
|
6
|
+
}
|
|
7
|
+
async handle(event) {
|
|
8
|
+
await this.sync.folderDeleted(event.payload.folder);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const SyncFolderCatalogOnFolderDeletedHandler = FolderAfterDeleteEventHandler.createImplementation({
|
|
12
|
+
implementation: SyncFolderCatalogOnFolderDeletedHandlerImpl,
|
|
13
|
+
dependencies: [
|
|
14
|
+
FolderCatalogSync
|
|
15
|
+
]
|
|
16
|
+
});
|
|
17
|
+
export default SyncFolderCatalogOnFolderDeletedHandler;
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=SyncFolderCatalogOnFolderDeletedHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderDeletedHandler.js","sources":["../../../../src/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderDeletedHandler.ts"],"sourcesContent":["import { FolderAfterDeleteEventHandler } from \"~/features/folder/DeleteFolder/abstractions.js\";\nimport { FolderCatalogSync } from \"./abstractions.js\";\n\nclass SyncFolderCatalogOnFolderDeletedHandlerImpl\n implements FolderAfterDeleteEventHandler.Interface\n{\n constructor(private sync: FolderCatalogSync.Interface) {}\n\n async handle(event: FolderAfterDeleteEventHandler.Event): Promise<void> {\n await this.sync.folderDeleted(event.payload.folder);\n }\n}\n\nexport default FolderAfterDeleteEventHandler.createImplementation({\n implementation: SyncFolderCatalogOnFolderDeletedHandlerImpl,\n dependencies: [FolderCatalogSync]\n});\n"],"names":["SyncFolderCatalogOnFolderDeletedHandlerImpl","sync","event","FolderAfterDeleteEventHandler","FolderCatalogSync"],"mappings":";;AAGA,MAAMA;IAGF,YAAoBC,IAAiC,CAAE;aAAnCA,IAAI,GAAJA;IAAoC;IAExD,MAAM,OAAOC,KAA0C,EAAiB;QACpE,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,CAACA,MAAM,OAAO,CAAC,MAAM;IACtD;AACJ;AAEA,gDAAeC,8BAA8B,oBAAoB,CAAC;IAC9D,gBAAgBH;IAChB,cAAc;QAACI;KAAkB;AACrC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FolderAfterUpdateEventHandler } from "../../../features/folder/UpdateFolder/abstractions.js";
|
|
2
|
+
import { FolderCatalogSync } from "./abstractions.js";
|
|
3
|
+
declare class SyncFolderCatalogOnFolderUpdatedHandlerImpl implements FolderAfterUpdateEventHandler.Interface {
|
|
4
|
+
private sync;
|
|
5
|
+
constructor(sync: FolderCatalogSync.Interface);
|
|
6
|
+
handle(event: FolderAfterUpdateEventHandler.Event): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: typeof SyncFolderCatalogOnFolderUpdatedHandlerImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher/abstractions.js").IEventHandler<import("@webiny/api-core/features/eventPublisher/abstractions.js").DomainEvent<import("~/features/folder/UpdateFolder/abstractions.js").FolderAfterUpdatePayload>>>;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FolderAfterUpdateEventHandler } from "../../folder/UpdateFolder/abstractions.js";
|
|
2
|
+
import { FolderCatalogSync } from "./abstractions.js";
|
|
3
|
+
class SyncFolderCatalogOnFolderUpdatedHandlerImpl {
|
|
4
|
+
constructor(sync){
|
|
5
|
+
this.sync = sync;
|
|
6
|
+
}
|
|
7
|
+
async handle(event) {
|
|
8
|
+
const { original, folder } = event.payload;
|
|
9
|
+
await this.sync.folderUpdated({
|
|
10
|
+
original,
|
|
11
|
+
folder
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const SyncFolderCatalogOnFolderUpdatedHandler = FolderAfterUpdateEventHandler.createImplementation({
|
|
16
|
+
implementation: SyncFolderCatalogOnFolderUpdatedHandlerImpl,
|
|
17
|
+
dependencies: [
|
|
18
|
+
FolderCatalogSync
|
|
19
|
+
]
|
|
20
|
+
});
|
|
21
|
+
export default SyncFolderCatalogOnFolderUpdatedHandler;
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=SyncFolderCatalogOnFolderUpdatedHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderUpdatedHandler.js","sources":["../../../../src/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderUpdatedHandler.ts"],"sourcesContent":["import { FolderAfterUpdateEventHandler } from \"~/features/folder/UpdateFolder/abstractions.js\";\nimport { FolderCatalogSync } from \"./abstractions.js\";\n\nclass SyncFolderCatalogOnFolderUpdatedHandlerImpl\n implements FolderAfterUpdateEventHandler.Interface\n{\n constructor(private sync: FolderCatalogSync.Interface) {}\n\n async handle(event: FolderAfterUpdateEventHandler.Event): Promise<void> {\n const { original, folder } = event.payload;\n await this.sync.folderUpdated({ original, folder });\n }\n}\n\nexport default FolderAfterUpdateEventHandler.createImplementation({\n implementation: SyncFolderCatalogOnFolderUpdatedHandlerImpl,\n dependencies: [FolderCatalogSync]\n});\n"],"names":["SyncFolderCatalogOnFolderUpdatedHandlerImpl","sync","event","original","folder","FolderAfterUpdateEventHandler","FolderCatalogSync"],"mappings":";;AAGA,MAAMA;IAGF,YAAoBC,IAAiC,CAAE;aAAnCA,IAAI,GAAJA;IAAoC;IAExD,MAAM,OAAOC,KAA0C,EAAiB;QACpE,MAAM,EAAEC,QAAQ,EAAEC,MAAM,EAAE,GAAGF,MAAM,OAAO;QAC1C,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC;YAAEC;YAAUC;QAAO;IACrD;AACJ;AAEA,gDAAeC,8BAA8B,oBAAoB,CAAC;IAC9D,gBAAgBL;IAChB,cAAc;QAACM;KAAkB;AACrC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Folder } from "../../../folder/folder.types.js";
|
|
2
|
+
export interface FolderCatalogSyncUpdatedParams {
|
|
3
|
+
original: Folder;
|
|
4
|
+
folder: Folder;
|
|
5
|
+
}
|
|
6
|
+
export interface IFolderCatalogSync {
|
|
7
|
+
/** A folder was saved. */
|
|
8
|
+
folderCreated(folder: Folder): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* A folder was changed. Its slug, parent or permissions may have changed, so the descendants'
|
|
11
|
+
* paths and inherited permissions may need updating too.
|
|
12
|
+
*/
|
|
13
|
+
folderUpdated(params: FolderCatalogSyncUpdatedParams): Promise<void>;
|
|
14
|
+
/** A folder was deleted. */
|
|
15
|
+
folderDeleted(folder: Folder): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Keeps whatever a storage derives from folders (folder permissions, descendant paths) in step with
|
|
19
|
+
* folder changes. Called after the folder change is saved; the change stands even if this fails.
|
|
20
|
+
*/
|
|
21
|
+
export declare const FolderCatalogSync: import("@webiny/di").Abstraction<IFolderCatalogSync>;
|
|
22
|
+
export declare namespace FolderCatalogSync {
|
|
23
|
+
type Interface = IFolderCatalogSync;
|
|
24
|
+
type UpdatedParams = FolderCatalogSyncUpdatedParams;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/flp/FolderCatalogSync/abstractions.js","sources":["../../../../src/features/flp/FolderCatalogSync/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Folder } from \"~/folder/folder.types.js\";\n\nexport interface FolderCatalogSyncUpdatedParams {\n original: Folder;\n folder: Folder;\n}\n\nexport interface IFolderCatalogSync {\n /** A folder was saved. */\n folderCreated(folder: Folder): Promise<void>;\n /**\n * A folder was changed. Its slug, parent or permissions may have changed, so the descendants'\n * paths and inherited permissions may need updating too.\n */\n folderUpdated(params: FolderCatalogSyncUpdatedParams): Promise<void>;\n /** A folder was deleted. */\n folderDeleted(folder: Folder): Promise<void>;\n}\n\n/**\n * Keeps whatever a storage derives from folders (folder permissions, descendant paths) in step with\n * folder changes. Called after the folder change is saved; the change stands even if this fails.\n */\nexport const FolderCatalogSync = createAbstraction<IFolderCatalogSync>(\"Aco/FolderCatalogSync\");\n\nexport namespace FolderCatalogSync {\n export type Interface = IFolderCatalogSync;\n export type UpdatedParams = FolderCatalogSyncUpdatedParams;\n}\n"],"names":["FolderCatalogSync","createAbstraction"],"mappings":";AAwBO,MAAMA,oBAAoBC,kBAAsC"}
|
|
@@ -3,7 +3,8 @@ import { FeatureFlags } from "@webiny/api-core/features/featureFlags/abstraction
|
|
|
3
3
|
import { ListUserTeamsUseCase } from "@webiny/api-core/features/users/ListUserTeams/index.js";
|
|
4
4
|
import { type CanAccessFolderContentParams, type CanAccessFolderParams } from "./useCases/index.js";
|
|
5
5
|
import { FolderLevelPermissions as FolderLevelPermissionsAbstraction } from "./abstractions.js";
|
|
6
|
-
import type { FolderLevelPermission, FolderPermission
|
|
6
|
+
import type { FolderLevelPermission, FolderPermission } from "../../../types.js";
|
|
7
|
+
import type { ListFolderPermissionsParams } from "../../../features/flp/FolderPermissionsRepository/abstractions.js";
|
|
7
8
|
import { ListFlpsUseCase } from "../../../features/flp/ListFlps/index.js";
|
|
8
9
|
import { GetFlpUseCase } from "../../../features/flp/GetFlp/index.js";
|
|
9
10
|
declare class FolderLevelPermissionsImpl implements FolderLevelPermissionsAbstraction.Interface {
|
|
@@ -25,10 +26,12 @@ declare class FolderLevelPermissionsImpl implements FolderLevelPermissionsAbstra
|
|
|
25
26
|
canManageFolderStructure(flp: FolderLevelPermission): Promise<boolean>;
|
|
26
27
|
canManageFolderPermissions(flp: FolderLevelPermission): Promise<boolean>;
|
|
27
28
|
getDefaultPermissions(permissions: FolderPermission[]): Promise<FolderPermission[]>;
|
|
28
|
-
|
|
29
|
+
getDefaultPermissionsBatch(permissionsList: FolderPermission[][]): Promise<FolderPermission[][]>;
|
|
30
|
+
listFolderLevelPermissions(params: ListFolderPermissionsParams): Promise<Array<{
|
|
29
31
|
id: string;
|
|
30
32
|
permissions: FolderPermission[];
|
|
31
33
|
}>>;
|
|
34
|
+
private createDefaultPermissions;
|
|
32
35
|
getFolderLevelPermissions(id: string): Promise<FolderPermission[]>;
|
|
33
36
|
}
|
|
34
37
|
export declare const FolderLevelPermissions: import("@webiny/di").Implementation<typeof FolderLevelPermissionsImpl>;
|
|
@@ -5,6 +5,8 @@ import { ListUserTeamsUseCase } from "@webiny/api-core/features/users/ListUserTe
|
|
|
5
5
|
import { NotAuthorizedError } from "@webiny/api-core/features/security/shared/index.js";
|
|
6
6
|
import { CanAccessFolder, CanAccessFolderContent, CanCreateFolderInRoot, CheckNotInheritedPermissions, GetDefaultPermissions, GetDefaultPermissionsWithTeams } from "./useCases/index.js";
|
|
7
7
|
import { FolderLevelPermissions } from "./abstractions.js";
|
|
8
|
+
import { DefaultPermissionsMerger } from "./useCases/GetDefaultPermissions/DefaultPermissionsMerger.js";
|
|
9
|
+
import { expandTeamPermissions } from "./useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.js";
|
|
8
10
|
import { ListFlpsUseCase } from "../ListFlps/index.js";
|
|
9
11
|
import { GetFlpUseCase } from "../GetFlp/index.js";
|
|
10
12
|
class FolderLevelPermissionsImpl {
|
|
@@ -77,20 +79,32 @@ class FolderLevelPermissionsImpl {
|
|
|
77
79
|
});
|
|
78
80
|
}
|
|
79
81
|
getDefaultPermissions(permissions) {
|
|
80
|
-
|
|
82
|
+
return this.createDefaultPermissions().execute(permissions);
|
|
83
|
+
}
|
|
84
|
+
async getDefaultPermissionsBatch(permissionsList) {
|
|
85
|
+
if (0 === permissionsList.length) return [];
|
|
86
|
+
const identity = this.identityContext.getIdentity();
|
|
87
|
+
const identityPermissions = await this.identityContext.listPermissions();
|
|
88
|
+
let identityTeams = [];
|
|
81
89
|
if (this.canUseTeams()) {
|
|
82
|
-
const
|
|
83
|
-
|
|
90
|
+
const result = await this.listUserTeamsUseCase.execute(identity.id);
|
|
91
|
+
identityTeams = result.isOk() ? result.value : [];
|
|
84
92
|
}
|
|
85
|
-
return
|
|
93
|
+
return permissionsList.map((permissions)=>DefaultPermissionsMerger.merge(identity, identityPermissions, this.canUseTeams() ? expandTeamPermissions(identity, identityTeams, permissions) : permissions));
|
|
86
94
|
}
|
|
87
95
|
async listFolderLevelPermissions(params) {
|
|
88
96
|
const flps = await this.listFlpsUseCase.execute(params);
|
|
97
|
+
const defaultPermissions = this.createDefaultPermissions();
|
|
89
98
|
return Promise.all(flps.map(async (flp)=>({
|
|
90
99
|
id: flp.id,
|
|
91
|
-
permissions: await
|
|
100
|
+
permissions: await defaultPermissions.execute(flp.permissions)
|
|
92
101
|
})));
|
|
93
102
|
}
|
|
103
|
+
createDefaultPermissions() {
|
|
104
|
+
const getDefaultPermissionsUseCase = new GetDefaultPermissions(this.identityContext);
|
|
105
|
+
if (!this.canUseTeams()) return getDefaultPermissionsUseCase;
|
|
106
|
+
return new GetDefaultPermissionsWithTeams(this.identityContext, this.listUserTeamsUseCase, getDefaultPermissionsUseCase);
|
|
107
|
+
}
|
|
94
108
|
async getFolderLevelPermissions(id) {
|
|
95
109
|
const flp = await this.getFlpUseCase.execute(id);
|
|
96
110
|
return await this.getDefaultPermissions(flp?.permissions ?? []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/flp/FolderLevelPermissions/FolderLevelPermissions.js","sources":["../../../../src/features/flp/FolderLevelPermissions/FolderLevelPermissions.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { FeatureFlags } from \"@webiny/api-core/features/featureFlags/abstractions.js\";\nimport { ListUserTeamsUseCase } from \"@webiny/api-core/features/users/ListUserTeams/index.js\";\nimport { NotAuthorizedError } from \"@webiny/api-core/features/security/shared/index.js\";\nimport {\n CanAccessFolder,\n CanAccessFolderContent,\n type CanAccessFolderContentParams,\n type CanAccessFolderParams,\n CanCreateFolderInRoot,\n CheckNotInheritedPermissions,\n GetDefaultPermissions,\n GetDefaultPermissionsWithTeams\n} from \"./useCases/index.js\";\nimport { FolderLevelPermissions as FolderLevelPermissionsAbstraction } from \"./abstractions.js\";\nimport type { FolderLevelPermission, FolderPermission, ListFlpsParams } from \"~/types.js\";\nimport { ListFlpsUseCase } from \"~/features/flp/ListFlps/index.js\";\nimport { GetFlpUseCase } from \"~/features/flp/GetFlp/index.js\";\n\nclass FolderLevelPermissionsImpl implements FolderLevelPermissionsAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private featureFlags: FeatureFlags.Interface,\n private listUserTeamsUseCase: ListUserTeamsUseCase.Interface,\n private getFlpUseCase: GetFlpUseCase.Interface,\n private listFlpsUseCase: ListFlpsUseCase.Interface\n ) {}\n\n public canUseFolderLevelPermissions(enabled?: boolean): boolean {\n if (enabled === false) {\n return false;\n }\n\n const identity = this.identityContext.getIdentity();\n\n // FLPs only work with authenticated identities (logged-in users).\n if (!identity) {\n return false;\n }\n\n // At the moment, we only want FLP to be used with identities of type \"admin\".\n // This temporarily addresses the issue of API keys not being able to access content, because\n // FLPs doesn't work with them. Once we start adding FLPs to API keys, we can remove this check.\n if (identity.type !== \"admin\") {\n return false;\n }\n\n return this.featureFlags\n .get()\n .isEnabled(\"advancedAccessControlLayer.folderLevelPermissions\");\n }\n\n public canUseTeams(): boolean {\n return this.featureFlags.get().isEnabled(\"advancedAccessControlLayer.teams\");\n }\n\n public canCreateFolderInRoot(): boolean {\n const canCreateFolderInRootUseCase = new CanCreateFolderInRoot();\n return canCreateFolderInRootUseCase.execute();\n }\n\n public permissionsIncludeNonInheritedPermissions(permissions: FolderPermission[]): boolean {\n const checkNotInheritedPermissionsUseCase = new CheckNotInheritedPermissions();\n return checkNotInheritedPermissionsUseCase.execute(permissions);\n }\n\n public async canAccessFolder(params: CanAccessFolderParams): Promise<boolean> {\n if (\n !this.canUseFolderLevelPermissions() ||\n !this.identityContext.isAuthorizationEnabled()\n ) {\n return true;\n }\n\n const canAccessFolderUseCase = new CanAccessFolder(this.identityContext);\n return await canAccessFolderUseCase.execute(params);\n }\n\n public async canAccessFolderContent(params: CanAccessFolderContentParams): Promise<boolean> {\n const canUseFlp = this.canUseFolderLevelPermissions();\n const authEnabled = this.identityContext.isAuthorizationEnabled();\n\n if (!canUseFlp || !authEnabled) {\n return true;\n }\n\n const canAccessFolderContentUseCase = new CanAccessFolderContent(this.identityContext);\n return await canAccessFolderContentUseCase.execute(params);\n }\n\n public async ensureCanAccessFolder(params: CanAccessFolderParams): Promise<void> {\n const result = await this.canAccessFolder(params);\n if (!result) {\n throw new NotAuthorizedError();\n }\n }\n\n public async ensureCanAccessFolderContent(params: CanAccessFolderContentParams): Promise<void> {\n const result = await this.canAccessFolderContent(params);\n if (!result) {\n throw new NotAuthorizedError();\n }\n }\n\n public async canManageFolderContent(flp: FolderLevelPermission): Promise<boolean> {\n if (\n !this.canUseFolderLevelPermissions() ||\n !this.identityContext.isAuthorizationEnabled()\n ) {\n return true;\n }\n\n return await this.canAccessFolderContent({ permissions: flp.permissions, rwd: \"w\" });\n }\n\n public async canManageFolderStructure(flp: FolderLevelPermission): Promise<boolean> {\n if (\n !this.canUseFolderLevelPermissions() ||\n !this.identityContext.isAuthorizationEnabled()\n ) {\n return true;\n }\n\n return await this.canAccessFolder({ permissions: flp.permissions, rwd: \"w\" });\n }\n\n public async canManageFolderPermissions(flp: FolderLevelPermission): Promise<boolean> {\n if (!this.canUseFolderLevelPermissions()) {\n return false;\n }\n\n if (!this.identityContext.isAuthorizationEnabled()) {\n return true;\n }\n\n return await this.canAccessFolder({\n permissions: flp.permissions,\n rwd: \"w\",\n managePermissions: true\n });\n }\n\n public getDefaultPermissions(permissions: FolderPermission[]): Promise<FolderPermission[]> {\n const getDefaultPermissionsUseCase = new GetDefaultPermissions(this.identityContext);\n\n if (this.canUseTeams()) {\n const getDefaultPermissionsWithTeams = new GetDefaultPermissionsWithTeams(\n this.identityContext,\n this.listUserTeamsUseCase,\n getDefaultPermissionsUseCase\n );\n\n return getDefaultPermissionsWithTeams.execute(permissions);\n }\n\n return getDefaultPermissionsUseCase.execute(permissions);\n }\n\n public async listFolderLevelPermissions(params: ListFlpsParams): Promise<\n Array<{\n id: string;\n permissions: FolderPermission[];\n }>\n > {\n const flps = await this.listFlpsUseCase.execute(params);\n\n return Promise.all(\n flps.map(async flp => ({\n id: flp.id,\n permissions: await this.getDefaultPermissions(flp.permissions)\n }))\n );\n }\n\n public async getFolderLevelPermissions(id: string): Promise<FolderPermission[]> {\n const flp = await this.getFlpUseCase.execute(id);\n return await this.getDefaultPermissions(flp?.permissions ?? []);\n }\n}\n\nexport const FolderLevelPermissions = createImplementation({\n abstraction: FolderLevelPermissionsAbstraction,\n implementation: FolderLevelPermissionsImpl,\n dependencies: [\n IdentityContext,\n FeatureFlags,\n ListUserTeamsUseCase,\n GetFlpUseCase,\n ListFlpsUseCase\n ]\n});\n"],"names":["FolderLevelPermissionsImpl","identityContext","featureFlags","listUserTeamsUseCase","getFlpUseCase","listFlpsUseCase","enabled","identity","canCreateFolderInRootUseCase","CanCreateFolderInRoot","permissions","checkNotInheritedPermissionsUseCase","CheckNotInheritedPermissions","params","canAccessFolderUseCase","CanAccessFolder","canUseFlp","authEnabled","canAccessFolderContentUseCase","CanAccessFolderContent","result","NotAuthorizedError","flp","getDefaultPermissionsUseCase","GetDefaultPermissions","getDefaultPermissionsWithTeams","GetDefaultPermissionsWithTeams","flps","Promise","id","FolderLevelPermissions","createImplementation","FolderLevelPermissionsAbstraction","IdentityContext","FeatureFlags","ListUserTeamsUseCase","GetFlpUseCase","ListFlpsUseCase"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"features/flp/FolderLevelPermissions/FolderLevelPermissions.js","sources":["../../../../src/features/flp/FolderLevelPermissions/FolderLevelPermissions.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { FeatureFlags } from \"@webiny/api-core/features/featureFlags/abstractions.js\";\nimport { ListUserTeamsUseCase } from \"@webiny/api-core/features/users/ListUserTeams/index.js\";\nimport { NotAuthorizedError } from \"@webiny/api-core/features/security/shared/index.js\";\nimport {\n CanAccessFolder,\n CanAccessFolderContent,\n type CanAccessFolderContentParams,\n type CanAccessFolderParams,\n CanCreateFolderInRoot,\n CheckNotInheritedPermissions,\n GetDefaultPermissions,\n GetDefaultPermissionsWithTeams,\n type IGetDefaultPermissions\n} from \"./useCases/index.js\";\nimport { FolderLevelPermissions as FolderLevelPermissionsAbstraction } from \"./abstractions.js\";\nimport { DefaultPermissionsMerger } from \"./useCases/GetDefaultPermissions/DefaultPermissionsMerger.js\";\nimport { expandTeamPermissions } from \"./useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.js\";\nimport type { Team } from \"@webiny/api-core/types/security.js\";\nimport type { FolderLevelPermission, FolderPermission } from \"~/types.js\";\nimport type { ListFolderPermissionsParams } from \"~/features/flp/FolderPermissionsRepository/abstractions.js\";\nimport { ListFlpsUseCase } from \"~/features/flp/ListFlps/index.js\";\nimport { GetFlpUseCase } from \"~/features/flp/GetFlp/index.js\";\n\nclass FolderLevelPermissionsImpl implements FolderLevelPermissionsAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private featureFlags: FeatureFlags.Interface,\n private listUserTeamsUseCase: ListUserTeamsUseCase.Interface,\n private getFlpUseCase: GetFlpUseCase.Interface,\n private listFlpsUseCase: ListFlpsUseCase.Interface\n ) {}\n\n public canUseFolderLevelPermissions(enabled?: boolean): boolean {\n if (enabled === false) {\n return false;\n }\n\n const identity = this.identityContext.getIdentity();\n\n // FLPs only work with authenticated identities (logged-in users).\n if (!identity) {\n return false;\n }\n\n // At the moment, we only want FLP to be used with identities of type \"admin\".\n // This temporarily addresses the issue of API keys not being able to access content, because\n // FLPs doesn't work with them. Once we start adding FLPs to API keys, we can remove this check.\n if (identity.type !== \"admin\") {\n return false;\n }\n\n return this.featureFlags\n .get()\n .isEnabled(\"advancedAccessControlLayer.folderLevelPermissions\");\n }\n\n public canUseTeams(): boolean {\n return this.featureFlags.get().isEnabled(\"advancedAccessControlLayer.teams\");\n }\n\n public canCreateFolderInRoot(): boolean {\n const canCreateFolderInRootUseCase = new CanCreateFolderInRoot();\n return canCreateFolderInRootUseCase.execute();\n }\n\n public permissionsIncludeNonInheritedPermissions(permissions: FolderPermission[]): boolean {\n const checkNotInheritedPermissionsUseCase = new CheckNotInheritedPermissions();\n return checkNotInheritedPermissionsUseCase.execute(permissions);\n }\n\n public async canAccessFolder(params: CanAccessFolderParams): Promise<boolean> {\n if (\n !this.canUseFolderLevelPermissions() ||\n !this.identityContext.isAuthorizationEnabled()\n ) {\n return true;\n }\n\n const canAccessFolderUseCase = new CanAccessFolder(this.identityContext);\n return await canAccessFolderUseCase.execute(params);\n }\n\n public async canAccessFolderContent(params: CanAccessFolderContentParams): Promise<boolean> {\n const canUseFlp = this.canUseFolderLevelPermissions();\n const authEnabled = this.identityContext.isAuthorizationEnabled();\n\n if (!canUseFlp || !authEnabled) {\n return true;\n }\n\n const canAccessFolderContentUseCase = new CanAccessFolderContent(this.identityContext);\n return await canAccessFolderContentUseCase.execute(params);\n }\n\n public async ensureCanAccessFolder(params: CanAccessFolderParams): Promise<void> {\n const result = await this.canAccessFolder(params);\n if (!result) {\n throw new NotAuthorizedError();\n }\n }\n\n public async ensureCanAccessFolderContent(params: CanAccessFolderContentParams): Promise<void> {\n const result = await this.canAccessFolderContent(params);\n if (!result) {\n throw new NotAuthorizedError();\n }\n }\n\n public async canManageFolderContent(flp: FolderLevelPermission): Promise<boolean> {\n if (\n !this.canUseFolderLevelPermissions() ||\n !this.identityContext.isAuthorizationEnabled()\n ) {\n return true;\n }\n\n return await this.canAccessFolderContent({ permissions: flp.permissions, rwd: \"w\" });\n }\n\n public async canManageFolderStructure(flp: FolderLevelPermission): Promise<boolean> {\n if (\n !this.canUseFolderLevelPermissions() ||\n !this.identityContext.isAuthorizationEnabled()\n ) {\n return true;\n }\n\n return await this.canAccessFolder({ permissions: flp.permissions, rwd: \"w\" });\n }\n\n public async canManageFolderPermissions(flp: FolderLevelPermission): Promise<boolean> {\n if (!this.canUseFolderLevelPermissions()) {\n return false;\n }\n\n if (!this.identityContext.isAuthorizationEnabled()) {\n return true;\n }\n\n return await this.canAccessFolder({\n permissions: flp.permissions,\n rwd: \"w\",\n managePermissions: true\n });\n }\n\n // With teams enabled, every call loads the current user's teams through `ListUserTeamsUseCase`\n // (an admin user read plus a team list). Nothing caches them between calls.\n public getDefaultPermissions(permissions: FolderPermission[]): Promise<FolderPermission[]> {\n return this.createDefaultPermissions().execute(permissions);\n }\n\n public async getDefaultPermissionsBatch(\n permissionsList: FolderPermission[][]\n ): Promise<FolderPermission[][]> {\n if (permissionsList.length === 0) {\n return [];\n }\n const identity = this.identityContext.getIdentity();\n const identityPermissions = await this.identityContext.listPermissions();\n\n let identityTeams: Team[] = [];\n if (this.canUseTeams()) {\n const result = await this.listUserTeamsUseCase.execute(identity.id);\n identityTeams = result.isOk() ? result.value : [];\n }\n\n // The same steps as getDefaultPermissions(), with the lookups done once.\n return permissionsList.map(permissions =>\n DefaultPermissionsMerger.merge(\n identity,\n identityPermissions,\n this.canUseTeams()\n ? expandTeamPermissions(identity, identityTeams, permissions)\n : permissions\n )\n );\n }\n\n public async listFolderLevelPermissions(params: ListFolderPermissionsParams): Promise<\n Array<{\n id: string;\n permissions: FolderPermission[];\n }>\n > {\n const flps = await this.listFlpsUseCase.execute(params);\n\n // One instance for every listed record: with teams enabled, the user's teams are loaded\n // once per call, not once per record.\n const defaultPermissions = this.createDefaultPermissions();\n return Promise.all(\n flps.map(async flp => ({\n id: flp.id,\n permissions: await defaultPermissions.execute(flp.permissions)\n }))\n );\n }\n\n private createDefaultPermissions(): IGetDefaultPermissions {\n const getDefaultPermissionsUseCase = new GetDefaultPermissions(this.identityContext);\n if (!this.canUseTeams()) {\n return getDefaultPermissionsUseCase;\n }\n return new GetDefaultPermissionsWithTeams(\n this.identityContext,\n this.listUserTeamsUseCase,\n getDefaultPermissionsUseCase\n );\n }\n\n public async getFolderLevelPermissions(id: string): Promise<FolderPermission[]> {\n const flp = await this.getFlpUseCase.execute(id);\n return await this.getDefaultPermissions(flp?.permissions ?? []);\n }\n}\n\nexport const FolderLevelPermissions = createImplementation({\n abstraction: FolderLevelPermissionsAbstraction,\n implementation: FolderLevelPermissionsImpl,\n dependencies: [\n IdentityContext,\n FeatureFlags,\n ListUserTeamsUseCase,\n GetFlpUseCase,\n ListFlpsUseCase\n ]\n});\n"],"names":["FolderLevelPermissionsImpl","identityContext","featureFlags","listUserTeamsUseCase","getFlpUseCase","listFlpsUseCase","enabled","identity","canCreateFolderInRootUseCase","CanCreateFolderInRoot","permissions","checkNotInheritedPermissionsUseCase","CheckNotInheritedPermissions","params","canAccessFolderUseCase","CanAccessFolder","canUseFlp","authEnabled","canAccessFolderContentUseCase","CanAccessFolderContent","result","NotAuthorizedError","flp","permissionsList","identityPermissions","identityTeams","DefaultPermissionsMerger","expandTeamPermissions","flps","defaultPermissions","Promise","getDefaultPermissionsUseCase","GetDefaultPermissions","GetDefaultPermissionsWithTeams","id","FolderLevelPermissions","createImplementation","FolderLevelPermissionsAbstraction","IdentityContext","FeatureFlags","ListUserTeamsUseCase","GetFlpUseCase","ListFlpsUseCase"],"mappings":";;;;;;;;;;;AAyBA,MAAMA;IACF,YACYC,eAA0C,EAC1CC,YAAoC,EACpCC,oBAAoD,EACpDC,aAAsC,EACtCC,eAA0C,CACpD;aALUJ,eAAe,GAAfA;aACAC,YAAY,GAAZA;aACAC,oBAAoB,GAApBA;aACAC,aAAa,GAAbA;aACAC,eAAe,GAAfA;IACT;IAEI,6BAA6BC,OAAiB,EAAW;QAC5D,IAAIA,AAAY,UAAZA,SACA,OAAO;QAGX,MAAMC,WAAW,IAAI,CAAC,eAAe,CAAC,WAAW;QAGjD,IAAI,CAACA,UACD,OAAO;QAMX,IAAIA,AAAkB,YAAlBA,SAAS,IAAI,EACb,OAAO;QAGX,OAAO,IAAI,CAAC,YAAY,CACnB,GAAG,GACH,SAAS,CAAC;IACnB;IAEO,cAAuB;QAC1B,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,GAAG,SAAS,CAAC;IAC7C;IAEO,wBAAiC;QACpC,MAAMC,+BAA+B,IAAIC;QACzC,OAAOD,6BAA6B,OAAO;IAC/C;IAEO,0CAA0CE,WAA+B,EAAW;QACvF,MAAMC,sCAAsC,IAAIC;QAChD,OAAOD,oCAAoC,OAAO,CAACD;IACvD;IAEA,MAAa,gBAAgBG,MAA6B,EAAoB;QAC1E,IACI,CAAC,IAAI,CAAC,4BAA4B,MAClC,CAAC,IAAI,CAAC,eAAe,CAAC,sBAAsB,IAE5C,OAAO;QAGX,MAAMC,yBAAyB,IAAIC,gBAAgB,IAAI,CAAC,eAAe;QACvE,OAAO,MAAMD,uBAAuB,OAAO,CAACD;IAChD;IAEA,MAAa,uBAAuBA,MAAoC,EAAoB;QACxF,MAAMG,YAAY,IAAI,CAAC,4BAA4B;QACnD,MAAMC,cAAc,IAAI,CAAC,eAAe,CAAC,sBAAsB;QAE/D,IAAI,CAACD,aAAa,CAACC,aACf,OAAO;QAGX,MAAMC,gCAAgC,IAAIC,uBAAuB,IAAI,CAAC,eAAe;QACrF,OAAO,MAAMD,8BAA8B,OAAO,CAACL;IACvD;IAEA,MAAa,sBAAsBA,MAA6B,EAAiB;QAC7E,MAAMO,SAAS,MAAM,IAAI,CAAC,eAAe,CAACP;QAC1C,IAAI,CAACO,QACD,MAAM,IAAIC;IAElB;IAEA,MAAa,6BAA6BR,MAAoC,EAAiB;QAC3F,MAAMO,SAAS,MAAM,IAAI,CAAC,sBAAsB,CAACP;QACjD,IAAI,CAACO,QACD,MAAM,IAAIC;IAElB;IAEA,MAAa,uBAAuBC,GAA0B,EAAoB;QAC9E,IACI,CAAC,IAAI,CAAC,4BAA4B,MAClC,CAAC,IAAI,CAAC,eAAe,CAAC,sBAAsB,IAE5C,OAAO;QAGX,OAAO,MAAM,IAAI,CAAC,sBAAsB,CAAC;YAAE,aAAaA,IAAI,WAAW;YAAE,KAAK;QAAI;IACtF;IAEA,MAAa,yBAAyBA,GAA0B,EAAoB;QAChF,IACI,CAAC,IAAI,CAAC,4BAA4B,MAClC,CAAC,IAAI,CAAC,eAAe,CAAC,sBAAsB,IAE5C,OAAO;QAGX,OAAO,MAAM,IAAI,CAAC,eAAe,CAAC;YAAE,aAAaA,IAAI,WAAW;YAAE,KAAK;QAAI;IAC/E;IAEA,MAAa,2BAA2BA,GAA0B,EAAoB;QAClF,IAAI,CAAC,IAAI,CAAC,4BAA4B,IAClC,OAAO;QAGX,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,sBAAsB,IAC5C,OAAO;QAGX,OAAO,MAAM,IAAI,CAAC,eAAe,CAAC;YAC9B,aAAaA,IAAI,WAAW;YAC5B,KAAK;YACL,mBAAmB;QACvB;IACJ;IAIO,sBAAsBZ,WAA+B,EAA+B;QACvF,OAAO,IAAI,CAAC,wBAAwB,GAAG,OAAO,CAACA;IACnD;IAEA,MAAa,2BACTa,eAAqC,EACR;QAC7B,IAAIA,AAA2B,MAA3BA,gBAAgB,MAAM,EACtB,OAAO,EAAE;QAEb,MAAMhB,WAAW,IAAI,CAAC,eAAe,CAAC,WAAW;QACjD,MAAMiB,sBAAsB,MAAM,IAAI,CAAC,eAAe,CAAC,eAAe;QAEtE,IAAIC,gBAAwB,EAAE;QAC9B,IAAI,IAAI,CAAC,WAAW,IAAI;YACpB,MAAML,SAAS,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAACb,SAAS,EAAE;YAClEkB,gBAAgBL,OAAO,IAAI,KAAKA,OAAO,KAAK,GAAG,EAAE;QACrD;QAGA,OAAOG,gBAAgB,GAAG,CAACb,CAAAA,cACvBgB,yBAAyB,KAAK,CAC1BnB,UACAiB,qBACA,IAAI,CAAC,WAAW,KACVG,sBAAsBpB,UAAUkB,eAAef,eAC/CA;IAGlB;IAEA,MAAa,2BAA2BG,MAAmC,EAKzE;QACE,MAAMe,OAAO,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,CAACf;QAIhD,MAAMgB,qBAAqB,IAAI,CAAC,wBAAwB;QACxD,OAAOC,QAAQ,GAAG,CACdF,KAAK,GAAG,CAAC,OAAMN,MAAQ;gBACnB,IAAIA,IAAI,EAAE;gBACV,aAAa,MAAMO,mBAAmB,OAAO,CAACP,IAAI,WAAW;YACjE;IAER;IAEQ,2BAAmD;QACvD,MAAMS,+BAA+B,IAAIC,sBAAsB,IAAI,CAAC,eAAe;QACnF,IAAI,CAAC,IAAI,CAAC,WAAW,IACjB,OAAOD;QAEX,OAAO,IAAIE,+BACP,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,oBAAoB,EACzBF;IAER;IAEA,MAAa,0BAA0BG,EAAU,EAA+B;QAC5E,MAAMZ,MAAM,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAACY;QAC7C,OAAO,MAAM,IAAI,CAAC,qBAAqB,CAACZ,KAAK,eAAe,EAAE;IAClE;AACJ;AAEO,MAAMa,gDAAyBC,qBAAqB;IACvD,aAAaC;IACb,gBAAgBrC;IAChB,cAAc;QACVsC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
|
|
@@ -13,6 +13,7 @@ declare class NoopFolderLevelPermissionsImpl implements IFolderLevelPermissions
|
|
|
13
13
|
canManageFolderStructure(): Promise<boolean>;
|
|
14
14
|
canManageFolderPermissions(): Promise<boolean>;
|
|
15
15
|
getDefaultPermissions(permissions: FolderPermission[]): Promise<FolderPermission[]>;
|
|
16
|
+
getDefaultPermissionsBatch(permissionsList: FolderPermission[][]): Promise<FolderPermission[][]>;
|
|
16
17
|
listFolderLevelPermissions(): Promise<Array<{
|
|
17
18
|
id: string;
|
|
18
19
|
permissions: FolderPermission[];
|
|
@@ -32,6 +32,9 @@ class NoopFolderLevelPermissionsImpl {
|
|
|
32
32
|
async getDefaultPermissions(permissions) {
|
|
33
33
|
return permissions;
|
|
34
34
|
}
|
|
35
|
+
async getDefaultPermissionsBatch(permissionsList) {
|
|
36
|
+
return permissionsList;
|
|
37
|
+
}
|
|
35
38
|
async listFolderLevelPermissions() {
|
|
36
39
|
return [];
|
|
37
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/flp/FolderLevelPermissions/NoopFolderLevelPermissions.js","sources":["../../../../src/features/flp/FolderLevelPermissions/NoopFolderLevelPermissions.ts"],"sourcesContent":["import { FolderLevelPermissions, type IFolderLevelPermissions } from \"./abstractions.js\";\nimport type { FolderPermission } from \"~/types.js\";\n\nclass NoopFolderLevelPermissionsImpl implements IFolderLevelPermissions {\n canUseFolderLevelPermissions(): boolean {\n return false;\n }\n\n canUseTeams(): boolean {\n return false;\n }\n\n canCreateFolderInRoot(): boolean {\n return true;\n }\n\n permissionsIncludeNonInheritedPermissions(): boolean {\n return false;\n }\n\n async canAccessFolder(): Promise<boolean> {\n return true;\n }\n\n async canAccessFolderContent(): Promise<boolean> {\n return true;\n }\n\n async ensureCanAccessFolder(): Promise<void> {\n return;\n }\n\n async ensureCanAccessFolderContent(): Promise<void> {\n return;\n }\n\n async canManageFolderContent(): Promise<boolean> {\n return true;\n }\n\n async canManageFolderStructure(): Promise<boolean> {\n return true;\n }\n\n async canManageFolderPermissions(): Promise<boolean> {\n return true;\n }\n\n async getDefaultPermissions(permissions: FolderPermission[]): Promise<FolderPermission[]> {\n return permissions;\n }\n\n async listFolderLevelPermissions(): Promise<\n Array<{ id: string; permissions: FolderPermission[] }>\n > {\n return [];\n }\n\n async getFolderLevelPermissions(): Promise<FolderPermission[]> {\n return [];\n }\n}\n\nexport const NoopFolderLevelPermissions = FolderLevelPermissions.createImplementation({\n implementation: NoopFolderLevelPermissionsImpl,\n dependencies: []\n});\n"],"names":["NoopFolderLevelPermissionsImpl","permissions","NoopFolderLevelPermissions","FolderLevelPermissions"],"mappings":";AAGA,MAAMA;IACF,+BAAwC;QACpC,OAAO;IACX;IAEA,cAAuB;QACnB,OAAO;IACX;IAEA,wBAAiC;QAC7B,OAAO;IACX;IAEA,4CAAqD;QACjD,OAAO;IACX;IAEA,MAAM,kBAAoC;QACtC,OAAO;IACX;IAEA,MAAM,yBAA2C;QAC7C,OAAO;IACX;IAEA,MAAM,wBAAuC,CAE7C;IAEA,MAAM,+BAA8C,CAEpD;IAEA,MAAM,yBAA2C;QAC7C,OAAO;IACX;IAEA,MAAM,2BAA6C;QAC/C,OAAO;IACX;IAEA,MAAM,6BAA+C;QACjD,OAAO;IACX;IAEA,MAAM,sBAAsBC,WAA+B,EAA+B;QACtF,OAAOA;IACX;IAEA,MAAM,6BAEJ;QACE,OAAO,EAAE;IACb;IAEA,MAAM,4BAAyD;QAC3D,OAAO,EAAE;IACb;AACJ;AAEO,MAAMC,6BAA6BC,uBAAuB,oBAAoB,CAAC;IAClF,
|
|
1
|
+
{"version":3,"file":"features/flp/FolderLevelPermissions/NoopFolderLevelPermissions.js","sources":["../../../../src/features/flp/FolderLevelPermissions/NoopFolderLevelPermissions.ts"],"sourcesContent":["import { FolderLevelPermissions, type IFolderLevelPermissions } from \"./abstractions.js\";\nimport type { FolderPermission } from \"~/types.js\";\n\nclass NoopFolderLevelPermissionsImpl implements IFolderLevelPermissions {\n canUseFolderLevelPermissions(): boolean {\n return false;\n }\n\n canUseTeams(): boolean {\n return false;\n }\n\n canCreateFolderInRoot(): boolean {\n return true;\n }\n\n permissionsIncludeNonInheritedPermissions(): boolean {\n return false;\n }\n\n async canAccessFolder(): Promise<boolean> {\n return true;\n }\n\n async canAccessFolderContent(): Promise<boolean> {\n return true;\n }\n\n async ensureCanAccessFolder(): Promise<void> {\n return;\n }\n\n async ensureCanAccessFolderContent(): Promise<void> {\n return;\n }\n\n async canManageFolderContent(): Promise<boolean> {\n return true;\n }\n\n async canManageFolderStructure(): Promise<boolean> {\n return true;\n }\n\n async canManageFolderPermissions(): Promise<boolean> {\n return true;\n }\n\n async getDefaultPermissions(permissions: FolderPermission[]): Promise<FolderPermission[]> {\n return permissions;\n }\n\n async getDefaultPermissionsBatch(\n permissionsList: FolderPermission[][]\n ): Promise<FolderPermission[][]> {\n return permissionsList;\n }\n\n async listFolderLevelPermissions(): Promise<\n Array<{ id: string; permissions: FolderPermission[] }>\n > {\n return [];\n }\n\n async getFolderLevelPermissions(): Promise<FolderPermission[]> {\n return [];\n }\n}\n\nexport const NoopFolderLevelPermissions = FolderLevelPermissions.createImplementation({\n implementation: NoopFolderLevelPermissionsImpl,\n dependencies: []\n});\n"],"names":["NoopFolderLevelPermissionsImpl","permissions","permissionsList","NoopFolderLevelPermissions","FolderLevelPermissions"],"mappings":";AAGA,MAAMA;IACF,+BAAwC;QACpC,OAAO;IACX;IAEA,cAAuB;QACnB,OAAO;IACX;IAEA,wBAAiC;QAC7B,OAAO;IACX;IAEA,4CAAqD;QACjD,OAAO;IACX;IAEA,MAAM,kBAAoC;QACtC,OAAO;IACX;IAEA,MAAM,yBAA2C;QAC7C,OAAO;IACX;IAEA,MAAM,wBAAuC,CAE7C;IAEA,MAAM,+BAA8C,CAEpD;IAEA,MAAM,yBAA2C;QAC7C,OAAO;IACX;IAEA,MAAM,2BAA6C;QAC/C,OAAO;IACX;IAEA,MAAM,6BAA+C;QACjD,OAAO;IACX;IAEA,MAAM,sBAAsBC,WAA+B,EAA+B;QACtF,OAAOA;IACX;IAEA,MAAM,2BACFC,eAAqC,EACR;QAC7B,OAAOA;IACX;IAEA,MAAM,6BAEJ;QACE,OAAO,EAAE;IACb;IAEA,MAAM,4BAAyD;QAC3D,OAAO,EAAE;IACb;AACJ;AAEO,MAAMC,6BAA6BC,uBAAuB,oBAAoB,CAAC;IAClF,gBAAgBJ;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CanAccessFolderContentParams, CanAccessFolderParams } from "./useCases/index.js";
|
|
2
|
-
import type { FolderLevelPermission, FolderPermission
|
|
2
|
+
import type { FolderLevelPermission, FolderPermission } from "../../../types.js";
|
|
3
|
+
import type { ListFolderPermissionsParams } from "../../../features/flp/FolderPermissionsRepository/abstractions.js";
|
|
3
4
|
export interface IFolderLevelPermissions {
|
|
4
5
|
canUseFolderLevelPermissions(enabled?: boolean): boolean;
|
|
5
6
|
canUseTeams(): boolean;
|
|
@@ -13,7 +14,12 @@ export interface IFolderLevelPermissions {
|
|
|
13
14
|
canManageFolderStructure(flp: FolderLevelPermission): Promise<boolean>;
|
|
14
15
|
canManageFolderPermissions(flp: FolderLevelPermission): Promise<boolean>;
|
|
15
16
|
getDefaultPermissions(permissions: FolderPermission[]): Promise<FolderPermission[]>;
|
|
16
|
-
|
|
17
|
+
/**
|
|
18
|
+
* `getDefaultPermissions` for many folders at once: the identity's teams and permissions are
|
|
19
|
+
* looked up once, not once per folder. Results are in the order of the input.
|
|
20
|
+
*/
|
|
21
|
+
getDefaultPermissionsBatch(permissionsList: FolderPermission[][]): Promise<FolderPermission[][]>;
|
|
22
|
+
listFolderLevelPermissions(params: ListFolderPermissionsParams): Promise<Array<{
|
|
17
23
|
id: string;
|
|
18
24
|
permissions: FolderPermission[];
|
|
19
25
|
}>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/flp/FolderLevelPermissions/abstractions.js","sources":["../../../../src/features/flp/FolderLevelPermissions/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { CanAccessFolderContentParams, CanAccessFolderParams } from \"./useCases/index.js\";\nimport type { FolderLevelPermission, FolderPermission
|
|
1
|
+
{"version":3,"file":"features/flp/FolderLevelPermissions/abstractions.js","sources":["../../../../src/features/flp/FolderLevelPermissions/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { CanAccessFolderContentParams, CanAccessFolderParams } from \"./useCases/index.js\";\nimport type { FolderLevelPermission, FolderPermission } from \"~/types.js\";\nimport type { ListFolderPermissionsParams } from \"~/features/flp/FolderPermissionsRepository/abstractions.js\";\n\nexport interface IFolderLevelPermissions {\n canUseFolderLevelPermissions(enabled?: boolean): boolean;\n canUseTeams(): boolean;\n canCreateFolderInRoot(): boolean;\n permissionsIncludeNonInheritedPermissions(permissions: FolderPermission[]): boolean;\n canAccessFolder(params: CanAccessFolderParams): Promise<boolean>;\n canAccessFolderContent(params: CanAccessFolderContentParams): Promise<boolean>;\n ensureCanAccessFolder(params: CanAccessFolderParams): Promise<void>;\n ensureCanAccessFolderContent(params: CanAccessFolderContentParams): Promise<void>;\n canManageFolderContent(flp: FolderLevelPermission): Promise<boolean>;\n canManageFolderStructure(flp: FolderLevelPermission): Promise<boolean>;\n canManageFolderPermissions(flp: FolderLevelPermission): Promise<boolean>;\n getDefaultPermissions(permissions: FolderPermission[]): Promise<FolderPermission[]>;\n /**\n * `getDefaultPermissions` for many folders at once: the identity's teams and permissions are\n * looked up once, not once per folder. Results are in the order of the input.\n */\n getDefaultPermissionsBatch(\n permissionsList: FolderPermission[][]\n ): Promise<FolderPermission[][]>;\n listFolderLevelPermissions(params: ListFolderPermissionsParams): Promise<\n Array<{\n id: string;\n permissions: FolderPermission[];\n }>\n >;\n getFolderLevelPermissions(id: string): Promise<FolderPermission[]>;\n}\n\n/** Manage folder-level access control. */\nexport const FolderLevelPermissions =\n createAbstraction<IFolderLevelPermissions>(\"FolderLevelPermissions\");\n\nexport namespace FolderLevelPermissions {\n export type Interface = IFolderLevelPermissions;\n}\n"],"names":["FolderLevelPermissions","createAbstraction"],"mappings":";AAmCO,MAAMA,yBACTC,kBAA2C"}
|
|
@@ -2,10 +2,22 @@ import type { IGetDefaultPermissions } from "./IGetDefaultPermissions.js";
|
|
|
2
2
|
import type { FolderPermission } from "../../../../../flp/flp.types.js";
|
|
3
3
|
import type { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
|
|
4
4
|
import { ListUserTeamsUseCase } from "@webiny/api-core/features/users/ListUserTeams/index.js";
|
|
5
|
+
import type { SecurityIdentity, Team } from "@webiny/api-core/types/security.js";
|
|
6
|
+
/**
|
|
7
|
+
* For every team of the identity that has a permission on the folder, grants the identity the same
|
|
8
|
+
* level, marked as inherited from the team. Returns a new list; the given one is not changed.
|
|
9
|
+
*/
|
|
10
|
+
export declare const expandTeamPermissions: (identity: SecurityIdentity | undefined, identityTeams: Team[], originalPermissions: FolderPermission[]) => FolderPermission[];
|
|
5
11
|
export declare class GetDefaultPermissionsWithTeams implements IGetDefaultPermissions {
|
|
6
12
|
private identityContext;
|
|
7
13
|
private listUserTeamsUseCase;
|
|
8
14
|
private decoretee;
|
|
15
|
+
/**
|
|
16
|
+
* The identity's teams, loaded once per instance and identity. An instance lives for one
|
|
17
|
+
* `getDefaultPermissions` call or one `listFolderLevelPermissions` call, so nothing is kept
|
|
18
|
+
* between calls or requests.
|
|
19
|
+
*/
|
|
20
|
+
private loaded;
|
|
9
21
|
constructor(identityContext: IdentityContext.Interface, listUserTeamsUseCase: ListUserTeamsUseCase.Interface, decoretee: IGetDefaultPermissions);
|
|
10
22
|
execute(originalPermissions: FolderPermission[]): Promise<FolderPermission[]>;
|
|
11
23
|
}
|
|
@@ -1,27 +1,35 @@
|
|
|
1
|
+
const expandTeamPermissions = (identity, identityTeams, originalPermissions)=>{
|
|
2
|
+
const permissions = [
|
|
3
|
+
...originalPermissions
|
|
4
|
+
];
|
|
5
|
+
if (identity && identityTeams.length) for (const identityTeam of identityTeams){
|
|
6
|
+
const teamPermission = permissions.find((p)=>p.target === `team:${identityTeam.slug}`);
|
|
7
|
+
if (teamPermission) permissions.push({
|
|
8
|
+
target: `admin:${identity.id}`,
|
|
9
|
+
level: teamPermission.level,
|
|
10
|
+
inheritedFrom: "team:" + identityTeam.slug
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return permissions;
|
|
14
|
+
};
|
|
1
15
|
class GetDefaultPermissionsWithTeams {
|
|
2
16
|
constructor(identityContext, listUserTeamsUseCase, decoretee){
|
|
17
|
+
this.loaded = null;
|
|
3
18
|
this.identityContext = identityContext;
|
|
4
19
|
this.listUserTeamsUseCase = listUserTeamsUseCase;
|
|
5
20
|
this.decoretee = decoretee;
|
|
6
21
|
}
|
|
7
22
|
async execute(originalPermissions) {
|
|
8
23
|
const identity = this.identityContext.getIdentity();
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const teamPermission = permissions.find((p)=>p.target === `team:${identityTeam.slug}`);
|
|
16
|
-
if (teamPermission) permissions.push({
|
|
17
|
-
target: `admin:${identity.id}`,
|
|
18
|
-
level: teamPermission.level,
|
|
19
|
-
inheritedFrom: "team:" + identityTeam.slug
|
|
20
|
-
});
|
|
21
|
-
}
|
|
24
|
+
if (!this.loaded || this.loaded.identityId !== identity.id) this.loaded = {
|
|
25
|
+
identityId: identity.id,
|
|
26
|
+
teams: this.listUserTeamsUseCase.execute(identity.id).then((result)=>result.isOk() ? result.value : [])
|
|
27
|
+
};
|
|
28
|
+
const identityTeams = await this.loaded.teams;
|
|
29
|
+
const permissions = expandTeamPermissions(identity, identityTeams, originalPermissions);
|
|
22
30
|
return await this.decoretee.execute(permissions);
|
|
23
31
|
}
|
|
24
32
|
}
|
|
25
|
-
export { GetDefaultPermissionsWithTeams };
|
|
33
|
+
export { GetDefaultPermissionsWithTeams, expandTeamPermissions };
|
|
26
34
|
|
|
27
35
|
//# sourceMappingURL=GetDefaultPermissionsWithTeams.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.js","sources":["../../../../../../src/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.ts"],"sourcesContent":["import type { IGetDefaultPermissions } from \"./IGetDefaultPermissions.js\";\nimport type { FolderPermission } from \"~/flp/flp.types.js\";\nimport type { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { ListUserTeamsUseCase } from \"@webiny/api-core/features/users/ListUserTeams/index.js\";\nimport type { Team } from \"@webiny/api-core/types/security.js\";\n\nexport class GetDefaultPermissionsWithTeams implements IGetDefaultPermissions {\n private identityContext: IdentityContext.Interface;\n private listUserTeamsUseCase: ListUserTeamsUseCase.Interface;\n private decoretee: IGetDefaultPermissions;\n\n constructor(\n identityContext: IdentityContext.Interface,\n listUserTeamsUseCase: ListUserTeamsUseCase.Interface,\n decoretee: IGetDefaultPermissions\n ) {\n this.identityContext = identityContext;\n this.listUserTeamsUseCase = listUserTeamsUseCase;\n this.decoretee = decoretee;\n }\n\n async execute(originalPermissions: FolderPermission[]) {\n /**\n * Retrieves the list of teams the current identity belongs to and checks if any of these teams\n * have permissions for the folder. If a team has permissions, the current identity is granted\n * the same permissions, inheriting them from the team.\n */\n const identity = this.identityContext.getIdentity();\n\n // Get teams for current identity
|
|
1
|
+
{"version":3,"file":"features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.js","sources":["../../../../../../src/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.ts"],"sourcesContent":["import type { IGetDefaultPermissions } from \"./IGetDefaultPermissions.js\";\nimport type { FolderPermission } from \"~/flp/flp.types.js\";\nimport type { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { ListUserTeamsUseCase } from \"@webiny/api-core/features/users/ListUserTeams/index.js\";\nimport type { SecurityIdentity, Team } from \"@webiny/api-core/types/security.js\";\n\n/**\n * For every team of the identity that has a permission on the folder, grants the identity the same\n * level, marked as inherited from the team. Returns a new list; the given one is not changed.\n */\nexport const expandTeamPermissions = (\n identity: SecurityIdentity | undefined,\n identityTeams: Team[],\n originalPermissions: FolderPermission[]\n): FolderPermission[] => {\n const permissions = [...originalPermissions]; // Clone the original permissions to avoid mutation.\n\n if (identity && identityTeams.length) {\n for (const identityTeam of identityTeams) {\n // Check if the team has permissions for the folder.\n const teamPermission = permissions.find(p => p.target === `team:${identityTeam.slug}`);\n\n if (teamPermission) {\n // Grant the current identity the same permissions as the team, marking them as inherited.\n permissions.push({\n target: `admin:${identity.id}`,\n level: teamPermission.level,\n inheritedFrom: \"team:\" + identityTeam.slug\n });\n }\n }\n }\n\n return permissions;\n};\n\ninterface LoadedTeams {\n identityId: string;\n teams: Promise<Team[]>;\n}\n\nexport class GetDefaultPermissionsWithTeams implements IGetDefaultPermissions {\n private identityContext: IdentityContext.Interface;\n private listUserTeamsUseCase: ListUserTeamsUseCase.Interface;\n private decoretee: IGetDefaultPermissions;\n /**\n * The identity's teams, loaded once per instance and identity. An instance lives for one\n * `getDefaultPermissions` call or one `listFolderLevelPermissions` call, so nothing is kept\n * between calls or requests.\n */\n private loaded: LoadedTeams | null = null;\n\n constructor(\n identityContext: IdentityContext.Interface,\n listUserTeamsUseCase: ListUserTeamsUseCase.Interface,\n decoretee: IGetDefaultPermissions\n ) {\n this.identityContext = identityContext;\n this.listUserTeamsUseCase = listUserTeamsUseCase;\n this.decoretee = decoretee;\n }\n\n async execute(originalPermissions: FolderPermission[]) {\n /**\n * Retrieves the list of teams the current identity belongs to and checks if any of these teams\n * have permissions for the folder. If a team has permissions, the current identity is granted\n * the same permissions, inheriting them from the team.\n */\n const identity = this.identityContext.getIdentity();\n\n // Get teams for current identity (once per instance and identity).\n if (!this.loaded || this.loaded.identityId !== identity.id) {\n this.loaded = {\n identityId: identity.id,\n teams: this.listUserTeamsUseCase.execute(identity.id).then(result => {\n return result.isOk() ? result.value : [];\n })\n };\n }\n const identityTeams: Team[] = await this.loaded.teams;\n\n const permissions = expandTeamPermissions(identity, identityTeams, originalPermissions);\n\n return await this.decoretee.execute(permissions);\n }\n}\n"],"names":["expandTeamPermissions","identity","identityTeams","originalPermissions","permissions","identityTeam","teamPermission","p","GetDefaultPermissionsWithTeams","identityContext","listUserTeamsUseCase","decoretee","result"],"mappings":"AAUO,MAAMA,wBAAwB,CACjCC,UACAC,eACAC;IAEA,MAAMC,cAAc;WAAID;KAAoB;IAE5C,IAAIF,YAAYC,cAAc,MAAM,EAChC,KAAK,MAAMG,gBAAgBH,cAAe;QAEtC,MAAMI,iBAAiBF,YAAY,IAAI,CAACG,CAAAA,IAAKA,EAAE,MAAM,KAAK,CAAC,KAAK,EAAEF,aAAa,IAAI,EAAE;QAErF,IAAIC,gBAEAF,YAAY,IAAI,CAAC;YACb,QAAQ,CAAC,MAAM,EAAEH,SAAS,EAAE,EAAE;YAC9B,OAAOK,eAAe,KAAK;YAC3B,eAAe,UAAUD,aAAa,IAAI;QAC9C;IAER;IAGJ,OAAOD;AACX;AAOO,MAAMI;IAWT,YACIC,eAA0C,EAC1CC,oBAAoD,EACpDC,SAAiC,CACnC;QAPD,KACO,MAAM,GAAuB;QAOjC,IAAI,CAAC,eAAe,GAAGF;QACvB,IAAI,CAAC,oBAAoB,GAAGC;QAC5B,IAAI,CAAC,SAAS,GAAGC;IACrB;IAEA,MAAM,QAAQR,mBAAuC,EAAE;QAMnD,MAAMF,WAAW,IAAI,CAAC,eAAe,CAAC,WAAW;QAGjD,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,KAAKA,SAAS,EAAE,EACtD,IAAI,CAAC,MAAM,GAAG;YACV,YAAYA,SAAS,EAAE;YACvB,OAAO,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAACA,SAAS,EAAE,EAAE,IAAI,CAACW,CAAAA,SAChDA,OAAO,IAAI,KAAKA,OAAO,KAAK,GAAG,EAAE;QAEhD;QAEJ,MAAMV,gBAAwB,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK;QAErD,MAAME,cAAcJ,sBAAsBC,UAAUC,eAAeC;QAEnE,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAACC;IACxC;AACJ"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { FolderLevelPermission } from "../../../flp/flp.types.js";
|
|
2
|
+
export interface ListFolderPermissionsParams {
|
|
3
|
+
where: {
|
|
4
|
+
type: string;
|
|
5
|
+
parentId?: string;
|
|
6
|
+
/** Folders whose path (e.g. `root/a`) starts with this. */
|
|
7
|
+
path_startsWith?: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface IFolderPermissionsRepository {
|
|
11
|
+
/**
|
|
12
|
+
* The folder's stored permissions: its own, plus the ones it inherits from its ancestors
|
|
13
|
+
* (marked `inheritedFrom: "parent:<id>"`). Code-defined permissions and the current identity's
|
|
14
|
+
* team and role permissions are not included; those are applied on top by the callers.
|
|
15
|
+
*/
|
|
16
|
+
get(folderId: string): Promise<FolderLevelPermission | null>;
|
|
17
|
+
/** The same, for every folder of a type, optionally only the children of one folder. */
|
|
18
|
+
list(params: ListFolderPermissionsParams): Promise<FolderLevelPermission[]>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Where folder permissions are read from. Every storage provides its own: some keep a catalog with
|
|
22
|
+
* the inherited permissions copied into each folder, others work them out when reading.
|
|
23
|
+
*/
|
|
24
|
+
export declare const FolderPermissionsRepository: import("@webiny/di").Abstraction<IFolderPermissionsRepository>;
|
|
25
|
+
export declare namespace FolderPermissionsRepository {
|
|
26
|
+
type Interface = IFolderPermissionsRepository;
|
|
27
|
+
type ListParams = ListFolderPermissionsParams;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/flp/FolderPermissionsRepository/abstractions.js","sources":["../../../../src/features/flp/FolderPermissionsRepository/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { FolderLevelPermission } from \"~/flp/flp.types.js\";\n\nexport interface ListFolderPermissionsParams {\n where: {\n type: string;\n parentId?: string;\n /** Folders whose path (e.g. `root/a`) starts with this. */\n path_startsWith?: string;\n };\n}\n\nexport interface IFolderPermissionsRepository {\n /**\n * The folder's stored permissions: its own, plus the ones it inherits from its ancestors\n * (marked `inheritedFrom: \"parent:<id>\"`). Code-defined permissions and the current identity's\n * team and role permissions are not included; those are applied on top by the callers.\n */\n get(folderId: string): Promise<FolderLevelPermission | null>;\n /** The same, for every folder of a type, optionally only the children of one folder. */\n list(params: ListFolderPermissionsParams): Promise<FolderLevelPermission[]>;\n}\n\n/**\n * Where folder permissions are read from. Every storage provides its own: some keep a catalog with\n * the inherited permissions copied into each folder, others work them out when reading.\n */\nexport const FolderPermissionsRepository = createAbstraction<IFolderPermissionsRepository>(\n \"Aco/FolderPermissionsRepository\"\n);\n\nexport namespace FolderPermissionsRepository {\n export type Interface = IFolderPermissionsRepository;\n export type ListParams = ListFolderPermissionsParams;\n}\n"],"names":["FolderPermissionsRepository","createAbstraction"],"mappings":";AA2BO,MAAMA,8BAA8BC,kBACvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./abstractions.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./abstractions.js";
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { GetFlpUseCase 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 GetFlpUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
5
|
+
private repository;
|
|
6
|
+
constructor(repository: FolderPermissionsRepository.Interface);
|
|
6
7
|
execute(id: string): Promise<FolderLevelPermission | null>;
|
|
7
8
|
}
|
|
9
|
+
export declare const GetFlpUseCase: typeof GetFlpUseCaseImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGetFolderPermission>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { GetFlpUseCase } from "./abstractions.js";
|
|
2
|
+
import { FolderPermissionsRepository } from "../FolderPermissionsRepository/index.js";
|
|
3
|
+
class GetFlpUseCaseImpl {
|
|
4
|
+
constructor(repository){
|
|
5
|
+
this.repository = repository;
|
|
4
6
|
}
|
|
5
7
|
async execute(id) {
|
|
6
|
-
return this.get(id);
|
|
8
|
+
return this.repository.get(id);
|
|
7
9
|
}
|
|
8
10
|
}
|
|
9
|
-
|
|
11
|
+
const GetFlpUseCase_GetFlpUseCase = GetFlpUseCase.createImplementation({
|
|
12
|
+
implementation: GetFlpUseCaseImpl,
|
|
13
|
+
dependencies: [
|
|
14
|
+
FolderPermissionsRepository
|
|
15
|
+
]
|
|
16
|
+
});
|
|
17
|
+
export { GetFlpUseCase_GetFlpUseCase as GetFlpUseCase };
|
|
10
18
|
|
|
11
19
|
//# sourceMappingURL=GetFlpUseCase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/flp/GetFlp/GetFlpUseCase.js","sources":["../../../../src/features/flp/GetFlp/GetFlpUseCase.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"features/flp/GetFlp/GetFlpUseCase.js","sources":["../../../../src/features/flp/GetFlp/GetFlpUseCase.ts"],"sourcesContent":["import { GetFlpUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { FolderPermissionsRepository } from \"~/features/flp/FolderPermissionsRepository/index.js\";\nimport type { FolderLevelPermission } from \"~/flp/flp.types.js\";\n\nclass GetFlpUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(private repository: FolderPermissionsRepository.Interface) {}\n\n async execute(id: string): Promise<FolderLevelPermission | null> {\n return this.repository.get(id);\n }\n}\n\nexport const GetFlpUseCase = UseCaseAbstraction.createImplementation({\n implementation: GetFlpUseCaseImpl,\n dependencies: [FolderPermissionsRepository]\n});\n"],"names":["GetFlpUseCaseImpl","repository","id","GetFlpUseCase","UseCaseAbstraction","FolderPermissionsRepository"],"mappings":";;AAIA,MAAMA;IACF,YAAoBC,UAAiD,CAAE;aAAnDA,UAAU,GAAVA;IAAoD;IAExE,MAAM,QAAQC,EAAU,EAAyC;QAC7D,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAACA;IAC/B;AACJ;AAEO,MAAMC,8BAAgBC,cAAAA,oBAAuC,CAAC;IACjE,gBAAgBJ;IAChB,cAAc;QAACK;KAA4B;AAC/C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GetFlpUseCase } from "../abstractions.js";
|
|
2
|
+
import { CodeFlpsProvider } from "../../../../features/flp/shared/index.js";
|
|
3
|
+
import type { FolderLevelPermission } from "../../../../flp/flp.types.js";
|
|
4
|
+
declare class GetFlpWithCodeFlpsImpl implements GetFlpUseCase.Interface {
|
|
5
|
+
private codeFlpsProvider;
|
|
6
|
+
private decoratee;
|
|
7
|
+
constructor(codeFlpsProvider: CodeFlpsProvider.Interface, decoratee: GetFlpUseCase.Interface);
|
|
8
|
+
execute(id: string): Promise<FolderLevelPermission | null>;
|
|
9
|
+
}
|
|
10
|
+
export declare const GetFlpWithCodeFlps: typeof GetFlpWithCodeFlpsImpl & {
|
|
11
|
+
__abstraction: import("@webiny/di").Abstraction<import("../abstractions.js").IGetFolderPermission>;
|
|
12
|
+
};
|
|
13
|
+
export {};
|