How to disable Alfresco main menu items?

The main menu in the Alfresco Share app contains a couple of items that the project team for our deployment wants to disable. In particular, "My files" and "Shared files". Hiding would be good enough, but if we can turn them off completely, that would be better. These are functions that users do not have access to. All their interactions must go through the sites.

Is the supported Alfresco supported (like "don't interrupt when we update")?

+2


source to share


1 answer


You have a blog post describing how to hide the main menu items in this link. It later turned out that this approach did not work on versions below 4.2.2. which is the case with your community version (4.2e).

You can use the workaround described in this link. Below is the exact code. At the bottom of share-header.get.js add the following



var widget, widgetsToRemove = [ "HEADER_SHARED_FILES", "HEADER_MY_FILES" ], idx, max;

for (idx = 0, max = widgetsToRemove.length; idx < max; idx++)
{  
    findAndRemoveIn(model.jsonModel.widgets, null, null, widgetsToRemove[idx]);
}


function findAndRemoveIn(obj, arrContext, arrIdx, id) {
var idx, max, key;
if (obj !== undefined && obj !== null) {
    if (Object.prototype.toString.apply(obj) === "[object Object]") {
        if (obj.hasOwnProperty("id") && obj.id === id) {
            if (arrContext !== null && arrIdx !== null)
            { arrContext.splice(arrIdx, 1); }

            else
            { logger .debug("Unexpected match outside of array structure: " + jsonUtils.toJSONString(obj)); }

        } else {
            for (key in obj) {
                if (obj.hasOwnProperty(key))
                { findAndRemoveIn(obj[key], null, null, id); }

            }
        }
    } else if (Object.prototype.toString.apply(obj) === "[object Array]") {
        for (idx = 0, max = obj.length; idx < max; idx++)
        { findAndRemoveIn(obj[idx], obj, idx, id); }

    }
  }
}   

      

You can later write an extension module when you get this working. Other items such as HEADER_NAVIGATION_MENU_BAR, HEADER_TITLE_MENU, HEADER_TITLE can be removed from the menu using the widgetUtils.deleteObjectFromArray helper function . The last option is to use CSS.

+4


source







All Articles