Hide Create Button for 2 level of folders | Community
Skip to main content
Level 3
July 27, 2023

Hide Create Button for 2 level of folders

  • July 27, 2023
  • 2 replies
  • 962 views

The user is allowed to create any folder under Explore category. But should not be allowed to create any grandchild folder of Explore or anything below Winter, Easter, etc.

 

Are there any ACLs through which we can control this, or granite render condition will work here?

I am thinking of having a JS to control it eventually if a direct way is not possible.

 

 

 

 

@DEBAL_DAS @arunpatidar @SantoshSai 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

aanchal-sikka
Community Advisor
Community Advisor
July 27, 2023

Hello @ashish_mishra1 

 

Please try to achieve the same via rendercondition on 

/libs/dam/gui/content/assets/jcr:content/actions/secondary/create/items/createfolder

 

It would assure that "Create Folder" option is available only at a certain level of the hierarchy

 

Defining rendercondition

Adapt following to your needs. This

 

<granite:rendercondition jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/renderconditions/simple" expression="${granite:relativeParent(requestPathInfo.suffix, 1) != '/content/dam/abc')}"/>

 

 

 

granite:relativeParent(String path, int level) Returns the n-th relative parent of the path, where n=level.

Examples:

granite:relativeParent("/a/b/c/d", 0) == "/a/b/c/d"
granite:relativeParent("/a/b/c/d", 1) == "/a/b/c"

 

 

Aanchal Sikka
Level 3
July 28, 2023

@aanchal-sikka Thanks, I tried this but seems some issue, it's not able to find the relative parent.

 

Can we use the restricted path property to match, something like 

 

restrictedPath = /a/b/c/*

 

So, it should not be visible in any folder below c but available till folder c

Sachin_Arora_
Community Advisor
Community Advisor
July 27, 2023

You can use rendercondition as explained by @aanchal-sikka
If possible please avoid doing such customization as you may face issue with upgrades.