I've been following the examples being worked out for the usage of Zend_Auth and Zend_Acl and have been thinking that these could be used to filter menu items so that user would only see menus that they are authorized to use.
I'd like to create a proposal for Zend_Menu, but I'm not an experienced enough programmer with php to purpose one, but I think it might be useful for some. So instead I will illustrate my thoughts and see if anyone who is capable wants to take up the task. For the sake of simplicity each menu item entry would need to specify a $route, some array of $parameters, and a boolean like $authorized that defaults to true. So something like $menu = new Zend_Menu(); $menu->addItem($route, $parameters); And when you are in your view you can use a foreach loop to run through creating menu items. If nothing more this furthers the goal of separating code from display. This could then be extended to work with Zend_Auth and Zend_Acl. It would require menu items that can be related to defined controller routes. Once a users role has been authorized and via Zend_Auth and Zend_Acl has been setup, you would need to loop through $menu and find the corresponding controller->route and set each $menu->isAuthorized to the result of $acl->isAllowed($role, $resource, $action). I know the $role would come from $auth and the $resource & $action come from the controller->route but I'm not yet capable of coding this. The advantage that I see to this approach is that I only need to define my menu items in a menu class. The logic of what the users have access to determines what they see in the menu. The method for displaying occurs cleanly in the view. Any thoughts? Jim Scherer -- View this message in context: http://www.nabble.com/Zend_Menu-Proposal--tf3189567s16154.html#a8853989 Sent from the Zend Framework mailing list archive at Nabble.com.
