How do I disable Alfresco main menu items?

被刻印的时光 ゝ 提交于 2019-12-02 05:15:22

问题


The main menu on the Alfresco Share app contains a couple of items that the project team for our deployment wants to have disabled. Specifically "My Files" and "Shared Files". Hiding would be good enough, but if we can disable them completely that would be best. Those are functions that the users are not to have any access to. All their interactions should be through the sites.

Is there an Alfresco supported (as in "won't break when we upgrade versions") way to do this?


回答1:


You have blog post describing how to hide main menu items at this link. It turned out later that this approach wasn't working on versions below 4.2.2. which is the case with your community version (4.2e) too.

You can use workaround described at this link. Below is the exact code you need. At the bottom of share-header.get.js add 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); }

    }
  }
}   

Later you can write extension module when you get this working. Other elements such as HEADER_NAVIGATION_MENU_BAR, HEADER_TITLE_MENU, HEADER_TITLE can be removed from menu using widgetUtils.deleteObjectFromArray helper function. Last option is to use CSS.



来源:https://stackoverflow.com/questions/24329850/how-do-i-disable-alfresco-main-menu-items

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!