Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Hiding Deactivate Page in sidekick

Avatar

Level 2

Hi All,

Can you please help how to hide Deactivate Page option from Side kick? I could able to do it from Site admin but could not able to get rid of this.

Thanks,

Phani

1 Accepted Solution

Avatar

Correct answer by
Administrator

phanirajkumarb74317693 wrote...

Hello Kautik, also how the javascript gets invoked in the above provided code? Do we need to call it from any component or?

 

Hi 

You will notice that the client library has category of “cq.widgets”. Using this category means its loaded with all of CQ’s standard widgets. No extra includes needed in the component!!

Reference article :- http://www.adamcancode.com/adobe-cqaem-custom-widgets/

~kautuk



Kautuk Sahni

View solution in original post

6 Replies

Avatar

Administrator

Please have a look at this community article:-

Link:- http://experience-aem.blogspot.in/2014/03/disable-sidekick-activate-deactivate.html

1) Code a servlet apps.experienceaem.sidekick.GetUserGroups to return the logged-in user groups.

2) Login to CRXDE Lite, create folder (nt:folder) /apps/skdisable

3) Create clientlib (type cq:ClientLibraryFolder) /apps/skdisable/clientlib and set a property categories of String type to cq.widgets

4) Create file ( type nt:file ) /apps/skdisable/clientlib/js.txt, add the following

                         disable.js

5) Create file ( type nt:file ) /apps/skdisable/clientlib/disable.js, add the following code

    (function(){
        if( ( window.location.pathname == "/cf" ) || ( window.location.pathname.indexOf("/content") == 0)){
            var SK_INTERVAL = setInterval(function(){
                var sk = CQ.WCM.getSidekick();
 
                if(sk && sk.panels){
                    clearInterval(SK_INTERVAL);
 
                    $.ajax({
                        url: '/bin/experienceaem/getgroups',
                        dataType: "json",
                        type: 'GET',
                        async: false,
                        success: function(data){
                            data = data[CQ.User.getCurrentUser().getUserID()];
 
                           if(data.indexOf("administrators") !== -1){
                                return;
                            }
                            var pagePanel = sk.panels["PAGE"];
 
                            var buttons = pagePanel.findBy(function(comp){
                                return comp["name"] == "PUBLISH" || comp["name"] == "DEACTIVATE";
                            }, pagePanel);
 
                            CQ.Ext.each(buttons, function(button){
                                button.setDisabled(true);
                            });
                        }
                    });
                }
            }, 250);
        }
    })();

~kautuk 



Kautuk Sahni

Avatar

Administrator

you can skip point 1 also, but then you can do it like.

// 

 if(CQ.User.getCurrentUser().hasPermissionOn("replicate", [CQ.WCM.getSidekick().getPath()])!=true){

            if(sk && sk.panels){
                clearInterval(SK_INTERVAL);


                        var pagePanel = sk.panels["PAGE"];

                        var buttons = pagePanel.findBy(function(comp){
                            return comp["name"] == "PUBLISH" || comp["name"] == "DEACTIVATE";
                        }, pagePanel);

                        CQ.Ext.each(buttons, function(button){
                            button.setDisabled(true);
                        });

                }



Kautuk Sahni

Avatar

Level 2

Thank you Kautuk,

Can't we hide it from Useradmin like a particular usergroup can't see this option(Deactivate Page)? This option was not there in CQ 5.5 but is seen in 6.2

Avatar

Administrator

phanirajkumarb74317693 wrote...

Thank you Kautuk,

Can't we hide it from Useradmin like a particular usergroup can't see this option(Deactivate Page)? This option was not there in CQ 5.5 but is seen in 6.2

 

I am not sure about it.

Let me ask this with internal people and then get back to you.

~kautuk



Kautuk Sahni

Avatar

Level 2

Hello Kautik, also how the javascript gets invoked in the above provided code? Do we need to call it from any component or?

Avatar

Correct answer by
Administrator

phanirajkumarb74317693 wrote...

Hello Kautik, also how the javascript gets invoked in the above provided code? Do we need to call it from any component or?

 

Hi 

You will notice that the client library has category of “cq.widgets”. Using this category means its loaded with all of CQ’s standard widgets. No extra includes needed in the component!!

Reference article :- http://www.adamcancode.com/adobe-cqaem-custom-widgets/

~kautuk



Kautuk Sahni