SugarClub
SugarClub
  • User
  • Site
  • Search
  • User
  • Groups & Discussions
    Groups & Discussions
    • Product Forums
      Product-focused Q&A, discussions, best practices, fixes, and help
      Product Forums
      • Sugar Market
      • Sugar Sell & Enterprise
      • Sugar Serve
      • sales-i
    • User Groups
      Professional, Industry, Language
    • Get Involved
      Learn how to become a Raving Fan
    • Social Club
      Live, interactive, virtual meetups with other Sugar customers and Sugar’s Subject Matter experts!
    • Leadership Lounge
      Network with fellow organizational leaders, ask questions, and share insights
    • Developers
      Visit DevClub, the SugarClub group for Sugar Developers
      Developers
      • DevClub
      • Mobile Developers
      • Developer Builds
        Supplemental access level required. Inquiries: developers@sugarcrm.com
    • Additional Groups (Access Required)
      Groups that require special access will be displayed here. Contact sugarclub@sugarcrm.com for assistance. Click here to see all groups
      Additional Groups (Access Required)
      • SugarCloud Platform
  • Product Information
    Product Information
    • Release Central
      Find release-specific content to prepare for your next Sugar update
    • Documentation & Resources
      Looking to expand your Sugar knowledge? Explore our in-depth documentation and other helpful resources!
    • Product Update Blogs
      Updates about each Sugar product
    • Customer Stories »
      Case Studies by SugarCRM
  • Training & Certification
    Training & Certification
    • Training & Certification Home
      Live & On-Demand classes, Quick Videos, Sugar Certifications, and more!
    • Quick Videos
      Short videos about using Sugar
    • Event Recordings
      Recordings from SugarU Live Webinars and Sugar Market Academy
    • My SugarU Dashboard »
    • SugarU News & Updates
  • Adoption
    Adoption
    • Grow Adoption Framework
      Get started on your adoption journey and review the adoption resources from SugarCRM
  • Calendar
  • News
    News
    • Sugar News
    • SugarCRM.com News »
    • Dev Blog
    • SugarCRM Marketplace Blog
  • Help
    Help
    • Welcome to Sugar!
      New to Sugar? Get started here!
    • SugarClub Help & Instructions
      Learn more about SugarClub and find answers to questions about this site
    • New to SugarClub?
      Start your community journey here
    • Technical Support
      Sugar's support resources
      Technical Support
      • Case Portal »
        Access the SugarCRM Case Portal
      • Working with Sugar Support »
        Find out more about engaging with the SugarCRM Support team
      • SugarCloud Information
        Find information about SugarCloud service updates and site status. Contact sugarclub@sugarcrm.com to request access
  • More from Sugar
    More from Sugar
    • DevClub
    • PartnerClub
    • Support
    • SugarOutfitters Marketplace
    • sugarcrm.com
  • DevClub
  • PartnerClub
  • Support
  • Marketplace
  • sugarcrm.com
DevClub
DevClub
Dev Tutorials Manipulate Modules from Sidebar Nav
Click here to join this group and curate your SugarClub experience.
  • +On-Boarding Framework
  • +Customization Guides
  • +Modern UI Technical Guide
      • Add/Remove Profile Action Links
      • Manipulate Modules from Sidebar Nav
      • Moving Footer content to Sidebar Nav
      • Pinned Modules Override
    • Expected Behavior
    • How to identify customizations to Refactor
    • Troubleshooting
  • +Automated PHP Compatibility Tool
  • +Customization Best Practices in Sugar
  • How to write code for SugarCloud webinar Q&A
  • HOW TO: enforce ACL on Tags
  • Remove custom fields created via package installation
  • Sugar Developer Tools
  • Tutorial:  How to register custom platforms in Sugar instances via Platform extension
  • Adding a google reCAPTCHA in a Web-to-Lead form
  • Sugar Developer Blog Style Guide

You are currently reviewing an older revision of this page.

  • History View current version

Manipulate Modules from Sidebar Nav

Hide Modules from the Module List

scott to work on an example.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
({
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'){
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
({
    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)
    },
})

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
({
/**
* @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'
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
({
    /**
     * @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;
    },
})