diff --git a/.changeset/eighty-cheetahs-burn.md b/.changeset/eighty-cheetahs-burn.md new file mode 100644 index 0000000000..3083598b21 --- /dev/null +++ b/.changeset/eighty-cheetahs-burn.md @@ -0,0 +1,5 @@ +--- +"@comet/cms-admin": patch +--- + +Hide the "Dependents" tab in the DAM for users without the permission `dependencies` diff --git a/packages/admin/cms-admin/src/dam/FileForm/EditFile.tsx b/packages/admin/cms-admin/src/dam/FileForm/EditFile.tsx index 93869cceaf..48cf55a441 100644 --- a/packages/admin/cms-admin/src/dam/FileForm/EditFile.tsx +++ b/packages/admin/cms-admin/src/dam/FileForm/EditFile.tsx @@ -26,6 +26,7 @@ import { useContentScope } from "../../contentScope/Provider"; import { useDependenciesConfig } from "../../dependencies/DependenciesConfig"; import { DependencyList } from "../../dependencies/DependencyList"; import { GQLFocalPoint, GQLImageCropAreaInput, GQLLicenseInput } from "../../graphql.generated"; +import { useUserPermissionCheck } from "../../userPermissions/hooks/currentUser"; import { useDamConfig } from "../config/useDamConfig"; import { LicenseValidityTags } from "../DataGrid/tags/LicenseValidityTags"; import Duplicates from "./Duplicates"; @@ -115,6 +116,7 @@ const EditFileInner = ({ file, id, contentScopeIndicator }: EditFileInnerProps) const intl = useIntl(); const damConfig = useDamConfig(); const apolloClient = useApolloClient(); + const isAllowed = useUserPermissionCheck(); const onSubmit = useCallback( async (values: EditFileFormValues) => { @@ -244,7 +246,7 @@ const EditFileInner = ({ file, id, contentScopeIndicator }: EditFileInnerProps) > - {Object.keys(dependencyMap).length > 0 && ( + {isAllowed("dependencies") && Object.keys(dependencyMap).length > 0 && (