Hello guys,
For a role I am trying to hide delete option for pages under "/content/A" but not for pages under "/content/B" and I have tried below statements but edit and delete option for components under those pages are also getting hidden . Can anyone provide any suggestions for this?
deny jcr:read on /libs/wcm/core/content/sites for /content/A/* restriction (rep:glob, "/jcr:content/actions/selection/deletepage")
deny jcr:read on /libs/wcm/core/content/sites restriction(rep:glob,/jcr:content/actions/selection/deletepage) restriction(rep:glob,/A)
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @newbie34 ,
There is a concept called granite:rendercondition in AEM and you can leverage this. By using this functionality you can show or hide any field in navigation according to your conditions. If your conditions are simple then you can define the expressions on node itself else if your conditions are complex then you can write a java class by implementing RenderCondition class and you can write your complex logic.
Please find below article.
https://ankanghosh-webdev.medium.com/granite-render-condition-in-aem-64d32f03a7d1
https://jpsoares.medium.com/aem-granite-render-conditions-438c804b1e5a
Thanks,
Ramesh.
Hi @newbie34 ,
There is a concept called granite:rendercondition in AEM and you can leverage this. By using this functionality you can show or hide any field in navigation according to your conditions. If your conditions are simple then you can define the expressions on node itself else if your conditions are complex then you can write a java class by implementing RenderCondition class and you can write your complex logic.
Please find below article.
https://ankanghosh-webdev.medium.com/granite-render-condition-in-aem-64d32f03a7d1
https://jpsoares.medium.com/aem-granite-render-conditions-438c804b1e5a
Thanks,
Ramesh.
Hi @newbie34,
Instead of trying to deny access to the global button definition, can you deny the permission to delete the page nodes themselves under /content/A. AEM uses JCR permissions to determine what buttons to show - if the user cannot delete the page node, the "Delete" button won't show for that page.
RepoInit Example: Deny jcr:remove Node under /content/A
# Create a service user or use existing group (eg. `content-editors`)
create service user content-editor-restricted
# Deny delete (jcr:removeNode) under /content/A
deny jcr:removeNode, jcr:removeChildNodes on /content/A restriction(rep:glob, "*")
# Allow delete under /content/B (optional if inherited from parent)
allow jcr:removeNode, jcr:removeChildNodes on /content/B restriction(rep:glob, "*")
Optionally you attach this to a group - If you're assigning this to a group, use:
create group content-editors
add user content-editor-restricted to group content-editors
# Now assign permissions to group
deny jcr:removeNode, jcr:removeChildNodes on /content/A restriction(rep:glob, "*") for group content-editors
Hi @newbie34 ,
To hide the "Delete Page" button only for pages under /content/A
without affecting other pages or component editing, use the following RepoInit rule: deny jcr:read on /libs/wcm/core/content/sites/jcr:content/actions/selection/deletepage restriction(rep:glob, "/content/A/*")
. This tells AEM to hide the delete button only when a page under /content/A
is selected in the Sites console. It won’t impact /content/B
or the ability to edit/delete components. If someone asks why it's still showing or not working, make sure the rule is applied to the correct user group, the glob path is accurate, and there are no conflicting allow permissions elsewhere.
Thanks!
Views
Likes
Replies