Hello,
Synopsis, I wanted to restrict the "Targeting" UI button by denying it thru ACL.
I know that /libs/wcm/core/content/editor/jcr:content/content/items/content/header/items/headerbar/items/selectlayerpopover/items/buttonlist generates the popover but I need to know what or how the button list is being populated in the dropdown for me to be able to restrict or modify it to disable and hide "Targeting" only while the rest of the modes are enabled and visible.
Only restricting of component or method thru ACL is acceptable for this one.
Thank you for all the help!
Views
Replies
Total Likes
you can write custom clientlib where you can define the logic of hiding the targetting button.
Example :
(function($, window) {
'use strict';
/* editor panel selector */
var headerSelector = '.editor-GlobalBar.editor-panel-header .header-main';
/* targeting mode selector */
var targetingLayer = '#selectlayer-popover .js-editor-LayerSwitcherTrigger[data-layer="Targeting"]';
$(window.document).ready( function() {
var header = $(headerSelector);
/* wait until content frame is loaded */
$(window.document).on('click', '[href="#selectlayer-popover"]', function() {
/* hide targeting layer */
header.find(targetingLayer).hide();
});
});
}(jQuery, window));
Thank you for the answer but for now only restricting/deny in AC Tool of component or the one that handles the rending of "Targeting" button is allowed.
Well, this can be achieved through java script, but since you are looking for an ACL option. I am assuming one specific approach may work and you can try the same. Here my understanding is this layer for Targeting is added based on presence of contexthub clientlib in the content page so you can identify your customheaderlibs.html HTL file of your page component, and use CQ Granite User API to determine logged in user's access and if the user has permission to the group you are referring to, then only add the clientlib, and ensure this is added only in WCM Edit Mode. See if this helps. Thanks !
Views
Like
Replies
Views
Likes
Replies
Views
Likes
Replies