简体   繁体   中英

Disable ContextMenu - IBM Content Navigator

Is there a way to disable a context menu item through a plugin through ACCE? Trying to understand if a context menu can be enabled/disabled based on the folder or based on the user's security groups. I am only able to set the privileges, but I need finer control than that.

Although this is an old question, an answer can be useful for someone.

The simplest way to do this - if you would like to remove it permanently - is to copy the containing menu and remove the menuitem you would like to hide, then replace the OOTB menu in desktop configuration with your custom one.

The other way is to create a Content Navigator plugin and you can create your custom action (menuitem) that does the exactly same thing that the menuitem you would like to control. When you install your plugin, your new action(menuitem) will be available in the menuitem list in the menu configuration. The next step is the same as you can see above: copy the OOTB menu, create a custom menu, then remove the original menuitem and replace with your custom one, then replace the OOTB menu with your custom menu.

There is an official github repo with sample plugins to find some ideas in this topic.

For example, in this custom CheckinAction the author would like to enable the checkin of the document only if the item (the document) is not locked, the DSSignatureStatus property is true and there are some other conditions in the superclass (eg the item is a Document, there is no checkin on Folder):

    /**
     * Returns true if this action should be enabled for the given repository, list type, and items.
     */
    isEnabled: function(repository, listType, items, teamspace, resultSet) 
    {
        var enabled = this.inherited(arguments);
        
        if(!items || items.length != 1){
            return false;
        };
        if(items[0].attributes && items[0].attributes.DSSignatureStatus == 3 && !items[0].locked) {
            return (enabled && true);
        }
        return false;
    },

    /**
     * Returns true if this action should be visible for the given repository and list type.
     */
    isVisible: function(repository, listType) 
    {
        return this.inherited(arguments);
    }

As you can see here, you can influence the visiblility too, you can decide to put your logic to the isVisible function if you would like to hide the menu, not just disable it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM