Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

How to make all the components in age non editable programmatically?

Avatar

Level 7

Hi Team,

 

I have a requirement to disable component dialog so that only the specific group of users can edit. I have 2 components in page. But only one component is getting non-editable. Please find the below code. I have included the below code's WCMUsePojo class at template level but no use. I even kept this in other component but not working. How can I make all the components in a page non-editable? Please suggest. 

 

ComponentContext componentContext = WCMUtils.getComponentContext(getRequest());

componentContext.setDecorate(false);

 

@kautuk_sahni 

 

Thanks in Advance.

AryA

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

You can achieve this via filter as well, 

check group against path and add componentContext.setDecorate(false);

e.g. https://github.com/arunpatidar02/aem63app-repo/blob/master/java/XFFilter.java



Arun Patidar

View solution in original post

3 Replies

Avatar

Community Advisor

Hi @Dinu_Arya,

 

You can leverage the lock concept in the AEM templates to disable the editing option of the component

Kiran_Vedantam_0-1636175623991.png

 

Hope this helps.

 

Thanks,

Kiran Vedantam

Avatar

Community Advisor

Hi @Dinu_Arya ,

 

If all the components in a page should be restricted to a certain groups, Please configure it through Group permissions.

 

https://experienceleague.adobe.com/docs/experience-manager-64/administering/security/security.html?l...

 

else if its only for some components please check if the below thread helps.

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-restrict-component-edi...

 

Avatar

Correct answer by
Community Advisor

Hi,

You can achieve this via filter as well, 

check group against path and add componentContext.setDecorate(false);

e.g. https://github.com/arunpatidar02/aem63app-repo/blob/master/java/XFFilter.java



Arun Patidar