Hide Modules from the Module List
scott to work on an example.
({ extendsFrom: 'ModuleListLayout', initialize: function(options) { this._super('initialize', [options]) }, /** * Adds all default menu views as components in both full and short * version. * * This will set the menu as sticky to differentiate from the others that * are added based on navigation/reference only. * * @private */ _addDefaultMenus: function() { var moduleList = app.metadata.getModuleNames({filter: 'display_tab', access: 'read'}) if (app.user.get('type') !== 'admin'){ moduleList = _.filter(moduleList, m => { if(m!=='ADR_Administrador' && m!=='ACC_Accesos' && m!=='POL_Policies') return m }) } _.each(moduleList, function(module) { this._addMenu(module, true) }, this) }, })
({ /** * @copyright: redk - Get further, together * @author: Maria Samuels maria.samuels@redk.net * @jira: FIDSUPP-118 */ extendsFrom: 'ModuleMenuView', /** * Filters menu actions by ACLs for the current user. * * @param {Array} meta The menu metadata to check access. * @return {Array} Returns only the list of actions the user has access. */ filterByAccess: function (meta) { var result = this._super('filterByAccess', [meta]); var spliceIdx = null; _.each(result, function (menuItem, idx) { if (menuItem.acl_action === 'product-massupdate' && app.user.get('type') !== 'admin' && !_.contains(app.user.get('roles') , 'Mass Update Products on RLIs') ) { spliceIdx = idx; } }); if (!_.isNull(spliceIdx)) { result.splice(spliceIdx, 1); } return result; }, })