how to restrict allowed components in policy properties aem for editable template

Avatar

Avatar
Boost 1
Level 1
AEM_65
Level 1

Like

1 like

Total Posts

6 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
AEM_65
Level 1

Like

1 like

Total Posts

6 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
AEM_65
Level 1

04-08-2020

one of our requirement is see if we can make changes to the layout policy properties, where we can restrict the allowed components that gets displayed for selection.

 

i.e. we want only our project component group to be displayed there instead of the whole groups (ex: General, ACS Commons .. e.t.c) that are available for selection as shown below.

 

 

 

Screen Shot 2020-08-04 at 12.52.16 PM.png

 

 

 @smacdonald2008 @Jörg_Hoh @kautuk_sahni @Arun_Patidar @BrianKasingli @Theo_Pendle 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,442 likes

Total Posts

3,314 posts

Correct reply

941 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,442 likes

Total Posts

3,314 posts

Correct reply

941 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

04-08-2020

Hi,

/libs/cq/gui/components/authoring/allowedcomponents/AllowedComponents.java is responsible to fetch all the components and shows in the allowed component part.

You can overlay /libs/cq/gui/components/authoring/allowedcomponents/allowedcomponents.html and add data-sly-test for ACS Common component groups

 

 

<coral-search placeholder="${'Search' @ i18n}" class="js-cq-AllowedComponents-filter cq-AllowedComponents-filter"></coral-search>
<coral-accordion variant="quiet" class="cq-AllowedComponents js-cq-AllowedComponents">
    <!--/* render component groups */-->
    <sly data-sly-use.api="libs.cq.gui.components.authoring.allowedcomponents.AllowedComponents"
        data-sly-repeat.group="${api.groups}">
        <sly data-sly-test=${group.title!='ACS Commons'} data-sly-use.template="componentgroup.html"
            data-sly-call="${template.componentGroup @ group=group}"/>
    </sly>
</coral-accordion>

 

 

 

AEM_65

Hi Arun,

Thanks for the reply, But here I dont want any of those groups.

I only need my project group. thats it.

 

Is there a way to restrict to show only my project group for component selection?

 

@Arun_Patidar 

 

Arun_Patidar
Yes, either you create your own allow component resource type like /libs/cq/gui/components/authoring/allowedcomponents or update above html to add condition to skip other groups except yours. I would suggest create your own type.
BrianKasingli

@AEM_65, also, you can also include some logic in /libs/cq/gui/components/authoring/allowedcomponents/AllowedComponents.java, during the overlay, to ensure that only specific group members are affected by the restricted view. Or your AEM environment will no longer be able to view other components going forward, unless if this is fine.

AEM_65

Hi Arun,

 

I tried to make the above mentioned changes. But when ever I have written the data-sly-test condition in the allowedcomponents.html in libs, the layout policy configuration itself it not opening.

 

Looks like this solution isnt working.

 

Can you please check this once.

 

Screen Shot 2020-08-05 at 10.03.33 AM.png

 

Thanks.

 

 

CC @Arun_Patidar  @BrianKasingli  @kautuk_sahni 

AEM_65
Hi Arun, I tried to make the above mentioned changes. But when ever I have written the data-sly-test condition the layout policy configuration itself it not opening, i.e. no action is being performed after clicking this action button
Arun_Patidar

Hi,

It could be because of syntax error in the answer which I shared with you. I forgot to enclosed data-sly-test condition

<div data-sly-test.isEditMode="${wcmmode.edit}">${isEditMode}</div>

 

  <sly data-sly-test="${group.title!='ACS Commons'}" data-sly-use.template="componentgroup.html"
            data-sly-call="${template.componentGroup @ group=group}"/>

 

 

Answers (1)

Answers (1)

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,442 likes

Total Posts

3,314 posts

Correct reply

941 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,442 likes

Total Posts

3,314 posts

Correct reply

941 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

10-08-2020

is this resolved? Let me know if you still looking for solution.

I created a custom allowed type with Generic approach. I will share the complete solution.

 

Arun_Patidar_0-1597076738167.png