Project

General

Profile

Feature #1740

Remove restricted menu's and menu items

Added by Cynetix Cynetix over 9 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
08/03/2011
Due date:
% Done:

0%

Estimated time:

Description

After creating a new user with limited permissions we found that the full menu structure was shown regardless. We have added the following code into fbegin.inc around line 235 to remove items out of the menus before the menu is built:

function filterAllowedPages(&$menu) {
    if(!is_array($menu)) return false;
    if(count($menu) < 2) return false;
    $ap = $_SESSION['page-match'];

    foreach($menu as $k => $v) {
        if(!cmp_page_matches($v[1], $ap)) unset($menu[$k]);
    }
}

filterAllowedPages($system_menu);
filterAllowedPages($interfaces_menu);
filterAllowedPages($firewall_menu);
filterAllowedPages($services_menu);
filterAllowedPages($vpn_menu);
filterAllowedPages($status_menu);
filterAllowedPages($diagnostics_menu);

Further down in the same file we have wrapped each LI element with a PHP if statement to check whether there are any menu items to display. If not, the top level menu item is ignored.

E.g.

<? if(count($system_menu) > 0): ?>
<li class="firstdrop">
    <div>System</div>
    <ul class="subdrop">
    <?php
        output_menu($system_menu);
    ?>
    </ul>
</li>
<?php endif; ?>

Is this something that can be added?

History

#1 Updated by Jim Pingle almost 9 years ago

  • Status changed from New to Closed

Duplicate of #773

Also available in: Atom PDF