Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Hide Create Button for 2 level of folders

Avatar

Level 4

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.

 

ashish_mishra1_0-1690423155686.png

 

 

 

@DEBAL_DAS @arunpatidar @SantoshSai 

3 Replies

Avatar

Community Advisor

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

Avatar

Level 4

@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

Avatar

Community Advisor

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