Hide advanced Reports menus options for non-admin

Hi, 

i would like to hide Custom Queries and DataSets for non-admin users. Is there any way, that i can do this under custom/modules/CustomQueries and custom/modules/DataSets?


Thanks!!



Samer Kaskas

Parents
  • Hi  ,

    From what I can see in a clean instance, non admins doesn't have the options to create Custom Query or Create Data Format so I am assuming the screenshot was taken as admin and the options you want to hide are the two highlighted.

    For that, you need to place the code shown below into custom/modules/ReportMaker/clients/base/menus/header/header.php

    <?php
    
    $module_name = 'ReportMaker';
    $viewdefs[$module_name]['base']['menu']['header'] = [
        [
            'route' => '#bwc/index.php?module=ReportMaker&action=EditView&return_module=ReportMaker&return_action=DetailView',
            'label' => 'LNK_NEW_REPORTMAKER',
            'acl_action' => 'admin',
            'acl_module' => 'ReportMaker',
            'icon' => 'sicon-plus',
        ],
        [
            'route' => '#bwc/index.php?module=ReportMaker&action=index&return_module=ReportMaker&return_action=index',
            'label' => 'LNK_LIST_REPORTMAKER',
            'acl_action' => '',
            'acl_module' => '',
            'icon' => 'sicon-list-view',
        ],
        [
            'route' => '#bwc/index.php?module=CustomQueries&action=EditView&return_module=CustomQueries&return_action=DetailView',
            'label' => 'LNK_NEW_CUSTOMQUERY',
            'acl_action' => 'admin',
            'acl_module' => 'CustomQueries',
            'icon' => 'siconl-plus',
        ],
        [
            'route' => '#bwc/index.php?module=CustomQueries&action=index&return_module=CustomQueries&return_action=DetailView',
            'label' => 'LNK_CUSTOMQUERIES',
            'acl_action' => 'admin',
            'acl_module' => 'CustomQueries',
            'icon' => 'sicon-list-view',
        ],
        [
            'route' => '#bwc/index.php?module=DataSets&action=EditView&return_module=DataSets&return_action=DetailView',
            'label' => 'LNK_NEW_DATASET',
            'acl_action' => 'admin',
            'acl_module' => 'DataSets',
            'icon' => 'sicon-plus',
        ],
        [
            'route' => '#bwc/index.php?module=DataSets&action=index&return_module=DataSets&return_action=index',
            'label' => 'LNK_LIST_DATASET',
            'acl_action' => 'admin',
            'acl_module' => 'DataSets',
            'icon' => 'sicon-list-view',
        ],
        [
            'route' => '#Reports',
            'label' => 'LBL_ALL_REPORTS',
            'acl_action' => '',
            'acl_module' => '',
            'icon' => 'sicon-reports',
        ],
    ];

    The code is basically modifying the standard file contained in /modules/ReportMaker/clients/base/menus/header/header.php to make these two options show only for admins, as it does with the options to Create Custom Query and Create Data Format.

    If your instance is hosted on Sugar's cloud you will need to create a package and install it via Module Loader.

    After that, run a Quick Repair and Rebuild and login as a regular user. You should see the menu like this:

    Hope this helps!

    Francesc

Reply
  • Hi  ,

    From what I can see in a clean instance, non admins doesn't have the options to create Custom Query or Create Data Format so I am assuming the screenshot was taken as admin and the options you want to hide are the two highlighted.

    For that, you need to place the code shown below into custom/modules/ReportMaker/clients/base/menus/header/header.php

    <?php
    
    $module_name = 'ReportMaker';
    $viewdefs[$module_name]['base']['menu']['header'] = [
        [
            'route' => '#bwc/index.php?module=ReportMaker&action=EditView&return_module=ReportMaker&return_action=DetailView',
            'label' => 'LNK_NEW_REPORTMAKER',
            'acl_action' => 'admin',
            'acl_module' => 'ReportMaker',
            'icon' => 'sicon-plus',
        ],
        [
            'route' => '#bwc/index.php?module=ReportMaker&action=index&return_module=ReportMaker&return_action=index',
            'label' => 'LNK_LIST_REPORTMAKER',
            'acl_action' => '',
            'acl_module' => '',
            'icon' => 'sicon-list-view',
        ],
        [
            'route' => '#bwc/index.php?module=CustomQueries&action=EditView&return_module=CustomQueries&return_action=DetailView',
            'label' => 'LNK_NEW_CUSTOMQUERY',
            'acl_action' => 'admin',
            'acl_module' => 'CustomQueries',
            'icon' => 'siconl-plus',
        ],
        [
            'route' => '#bwc/index.php?module=CustomQueries&action=index&return_module=CustomQueries&return_action=DetailView',
            'label' => 'LNK_CUSTOMQUERIES',
            'acl_action' => 'admin',
            'acl_module' => 'CustomQueries',
            'icon' => 'sicon-list-view',
        ],
        [
            'route' => '#bwc/index.php?module=DataSets&action=EditView&return_module=DataSets&return_action=DetailView',
            'label' => 'LNK_NEW_DATASET',
            'acl_action' => 'admin',
            'acl_module' => 'DataSets',
            'icon' => 'sicon-plus',
        ],
        [
            'route' => '#bwc/index.php?module=DataSets&action=index&return_module=DataSets&return_action=index',
            'label' => 'LNK_LIST_DATASET',
            'acl_action' => 'admin',
            'acl_module' => 'DataSets',
            'icon' => 'sicon-list-view',
        ],
        [
            'route' => '#Reports',
            'label' => 'LBL_ALL_REPORTS',
            'acl_action' => '',
            'acl_module' => '',
            'icon' => 'sicon-reports',
        ],
    ];

    The code is basically modifying the standard file contained in /modules/ReportMaker/clients/base/menus/header/header.php to make these two options show only for admins, as it does with the options to Create Custom Query and Create Data Format.

    If your instance is hosted on Sugar's cloud you will need to create a package and install it via Module Loader.

    After that, run a Quick Repair and Rebuild and login as a regular user. You should see the menu like this:

    Hope this helps!

    Francesc

Children