How to make all the components in age non editable programmatically? | Community
Skip to main content
Dinu_Arya
Level 6
November 5, 2021
Solved

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

  • November 5, 2021
  • 3 replies
  • 1878 views

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

 

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

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

3 replies

Kiran_Vedantam
Community Advisor
Community Advisor
November 6, 2021

Hi @dinu_arya,

 

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

 

Hope this helps.

 

Thanks,

Kiran Vedantam

Kishore_Kumar_
Level 9
November 6, 2021

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?lang=en

 

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-editing-and-allowed-only-for-certain/m-p/358938

 

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
November 8, 2021

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