cwhisperer
cwhisperer

Reputation: 1926

zend navigation partial with acl not working

I have some trouble with navigation and acl, speaking the permissions are not respected in the menu. I have an xml config file with the menu. In my bootstrap I initiliaze the menu as following:

    protected function _initNavigationXml() {
    $this->bootstrap('layout');
    $layout = $this->getResource('layout');
    $view = $layout->getView();
    $config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml');

    $navigation = new Zend_Navigation($config);
    $view->navigation($navigation)->setAcl($this->_acl)->setRole($this->_auth->getIdentity()->role);
}

Due to special format of the menu I have to display it in a partial phtml file, like:

<?php
$partial = array('sidemenu.phtml', 'default');
$this->navigation()->menu()->setPartial($partial);
echo $this->navigation()->menu()->renderPartial();
?>

The menu shows well, but the resources are not respected.

Adding following

echo $this->navigation()->menu()->renderMenu();

before $partial, the menu is correct and the resources are respected.

Any help or further questions will be appreciated ;)
Regards
Andrea

Upvotes: 1

Views: 1325

Answers (1)

ChrisA
ChrisA

Reputation: 2091

The renderMenu() method includes code to check whether the page is visible given the ACL permissions you set. As far as I can see, if you're using renderPartial(), you'll need to handle the ACL checks yourself.

Upvotes: 2

Related Questions