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
SOLVED

OOTB privilege render condition not working to show/hide custom selection action on folder(assets Touch UI) based on custom privilege

Avatar

Level 2

Implemented a new jcr:namespace ("xyz") and based on that created a custom privilege ("xyz:superUser").

Now im assigning this privilege to a testUser on a given dam path (e.g. /content/dam/we-retail/activites/biking). User also has jcr:read permission on /content

My requirement is to hide/unhide a custom option(e.g. "Confirm Data") in top rail selection action bar  on the asset Touch UI based on the user having the custom privilege("xyz:superUser") or not on that path.

Overlayed the /libs/dam/gui/content/assets/jcr:content/actions/selection and created a custom action(e.g. "Confirm Data") .

Implemented the granite:rendercondition node under it and used the OOTB rendercondition(/libs/granite/ui/components/foundation/renderconditions/privilege).

Properties added to it

path String ${requestPathInfo.suffix}   --------> to get the path 

privileges String[]  xyz:superUser        ---------> to check the privilege required

 

Now when i log in as testUser, on selecting the biking folder, the top rail selection action bar should show the "Confirm Data" option based on the privilege given to the user.

But it is not working.

 

Can this be achieved by simply using the OOTB privilege render condition?

Can somebody guide me how it can be achieved.

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Try with granite/ui/components/coral/foundation/renderconditions/privilege

One more point , Rendererconditions only works on page load(backend rendering) not on selecting folder and navigating in dam folder structure, to achieve hide of custom button, you can simply deny access to /apps/dam/gui/content/assets/jcr:content/actions/selection/custom



Arun Patidar

View solution in original post

5 Replies

Avatar

Correct answer by
Community Advisor

Try with granite/ui/components/coral/foundation/renderconditions/privilege

One more point , Rendererconditions only works on page load(backend rendering) not on selecting folder and navigating in dam folder structure, to achieve hide of custom button, you can simply deny access to /apps/dam/gui/content/assets/jcr:content/actions/selection/custom



Arun Patidar

Avatar

Level 2

Hi Arun,
Thanks for the update 

 

So if i want to show/hide an option based on rendercondition, that will not work on selecting an asset or folder?

Also how do i deny access to /apps/dam/gui/content/assets/jcr:content/actions/selection/custom

Avatar

Community Advisor
yes, it will not work on selection. You can deny access for this node either from useradmin or from crxde.


Arun Patidar

Avatar

Level 2

Hello Arun

 

So privilege rendercondition works fine on first load on particular path but does not work when user navigates in assets. That seems to be major drawback to the rendercondition feature. Do we have any workaround for this through any customization? Did not quite get your second part about denying access to /apps/dam/gui/content/assets/jcr:content/actions/selection/custom. Can you please elaborate?

 

Thanks

Avatar

Level 1

I'm facing the same issue, I added an anchor button to the assets selection action toolbar. Now I have a render condition which allows this button to be visible in a specific folder say: startsWith (/content/dam/a/path)

 

It works when we open any folder in /content/dam/a/path directly. Then, after you navigate out of the folder, the toolbar/action bar doesn't get refreshed, which keeps this button visible in other hierarchies as well.