Firstly, I should just point out how nice the new menu.php file is.
This is my best attempt at making this logic clear in pseudo-code, and pointing out potential errors in logic (although most of them are unlikely to ever actually happen in practice). Hopefully we can reach consensus here on the minor changes that can be made for the 0.9.5 release.
There are IFs around some entire menus, and around some menu lines, so I’m showing the IFs on the same line as the menu item, and the IFs (or EVERYONE if there isn’t an IF) at the top of each menu. I think this makes sense. Any menu item that starts a line without an IF is visible to anyone who can see that particular menu. I’ve then pointed out potential problems after each menu.
<?php
# security menu
$security_menu = '';
/* manager-users */ if($modx->hasPermission('new_user')||$modx->hasPermission('edit_user'))
$security_menu .= '<li><a onclick="this.blur();" href="index.php?a=75" target="main">'.$_lang["user_management_title"].'</a></li>';
/* web-users */ if($modx->hasPermission('new_web_user')||$modx->hasPermission('edit_web_user'))
$security_menu .= '<li><a onclick="this.blur();" href="index.php?a=99" target="main">'.$_lang["web_user_management_title"].'</a></li>';
/*roles */ if($modx->hasPermission('new_role')||$modx->hasPermission('edit_user'))
$security_menu .= '<li><a onclick="this.blur();" href="index.php?a=86" target="main">'.$_lang["role_management_title"].'</a></li>';
/* manager-perms */ if($modx->hasPermission('access_permissions'))
$security_menu .= '<li><a onclick="this.blur();" href="index.php?a=40" target="main">'.$_lang["manager_permissions"].'</a></li>';
/* web-user-perms*/ if($modx->hasPermission('web_access_permissions'))
$security_menu .= '<li><a onclick="this.blur();" href="index.php?a=91" target="main">'.$_lang["web_permissions"].'</a></li>';
#same for other menu's
?>
<!-- All the html stuff -->
<!-- Security (users) -->
<?php if( $security_menu ) { ?>
<li id="limenu2"><a href="#menu2" onclick="new NavToggle(this); return false;"><?php echo $_lang["users"]; ?></a>
<ul class="subnav" id="menu2">
<?php echo $security_menu; ?>
</ul>
</li>
<?php } ?>
<!-- Clean up -->
<?php
unset($security_menu);
?>
I’ve got it David.
As ever, willing to proof-read any text - just PM me.
Then check out this thread : http://modxcms.com/forums/index.php/topic,8293.0.html
Next actions:
1) Compare the permissions used in the routines to those checked for in the menu (at least one is in doubt) and
a) change menu if needed
b) point out any major anomolies
2) Overhaul menu as per my notes and TobyL’s superb suggestion
I can do this in about 8 hours time, but if someone wants to do it before, be my guest.
This discussion is closed to further replies. Keep calm and carry on.