I have a problem with integration BjyAuthorize
and Zend navigation and don't know how to resolve them. I try this manual and everything works fine. But I expected when I define guards in bjyauthorize.config
and after that, there will be reflection between my navigation and guard configuration (denied controllers or routes does not display navigation items). My problem is that navigation items are still displayed, but sections are correctly protected. Is there any way, how to reflect guards into navigation?
My view helper config in Module.php
My Application/Module.php view helper configuration:
'mainMenu' => function($sm){
$nav = $sm->get('navigation')->menu();
$serviceLocator = $sm->getServiceLocator();
$acl = $serviceLocator->get('BjyAuthorize\Service\Authorize')->getAcl();
$role = $serviceLocator->get('BjyAuthorize\Service\Authorize')->getIdentity();
$nav->setAcl($acl);
$nav->setRole($role); // Todo replace
$nav->setUseAcl();
return $nav->setUlClass('nav')->setTranslatorTextDomain(__NAMESPACE__);
}
My guard configuration in bjyauthorize.global.php
'guards' => array(
'BjyAuthorize\Guard\Controller' => array(
array('controller' => 'Article\Controller\Article', 'roles' => array('user')),
),
And My navigation.global.php
return array(
'navigation' => array(
'default' => array(
'articles' => array(
'label' => 'Articles',
'route' => 'articles',
),
),
));
I try to change routes configuration to module/controller/action and still does not work.