AEM 6 - Classic UI Disable Set Password


Disable Set Password if a user doesn't have necessary permissions. Without this extension a user will still not be able to change the password if he doesnt have necessary permissions, but user can click on Set Password button and the dialog shows up giving user impression that he/she can change password

Demo | Package Install

If a user doesn't have necessary permissions (here user author doesn't have modify permission on node /home/users/geometrixx/author which stores user password )...

Set Password disabled for author


1) Login to CRXDE Lite (http://localhost:4502/crx/de) and create folder /apps/classic-ui-disable-set-password

2) Create node /apps/classic-ui-disable-set-password/clientlib of type cq:ClientLibraryFolder and add a String property categories with value

3) Create file (nt:file) /apps/classic-ui-disable-set-password/clientlib/js.txt and add


4) Create file (nt:file) /apps/classic-ui-disable-set-password/clientlib/disable.js and add the following code.

    //id set in \libs\cq\security\widgets\source\widgets\security\UserAdmin.js
    var USER_ADMIN_ID = "cq-useradmin";

    if(window.location.pathname == "/useradmin"){
        var UA_INTERVAL = setInterval(function(){
            var userAdmin = CQ.Ext.getCmp(USER_ADMIN_ID);

            if(userAdmin && userAdmin.userProperties && userAdmin.userProperties.pwdButtons){

                var pwdButtons = userAdmin.userProperties.pwdButtons;
                var setPassword = pwdButtons.filter("text", "Set Password").get(0);
                var authorizableList = userAdmin.list;

                authorizableList.getSelectionModel().on('selectionchange', function(sm){
                    var selected = sm.getSelected();


                    //var hasPerm = CQ.User.getCurrentUser().hasPermissionOn("modify",;

                    var user = CQ.User.getCurrentUser();


                        url: "/.cqactions.json",
                        data: {
                            authorizableId: user.getUserID()
        }, 250);

No comments:

Post a Comment