Closed pimjansen closed 10 years ago
$page->getPermission()
will return null
unless you set the value. Not a zfc-rbac issue.
Can you tell me how to set it on the page itself? Its not really clear in the docs if you ask me? Isnt it a bit weird that the guard is blocking it even though the page itself does not know it?
IIRC, simply add a permission
key to your page config.
Like in the Rbac settings above or in the router definitions?
'router' => array(
'routes' => array(
'relation' => array(
'type' => 'Segment',
'priority' => 2000,
'permission' => 'relation',
'options' => array(
'route' => '/relation[/:action][/:id][/:search]',
'defaults' => array(
'controller' => 'SenetRelation\Controller\RelationController',
'action' => 'index',
'id' => null,
'search' => '',
),
),
),
)
)
In navigation config.
I'm closing this. Zend\Navigation is a bit broken and ZfcRbac integration is not easy.
What kind of integration do you recommend then if I would like to use Zend\Navigation
with ZfcRbac
- a listener
like in the following example?
http://stackoverflow.com/a/18942160/1937050
I tried the example I posted above but the solution no longer seems to work @bakura10 @danizord : https://github.com/ZF-Commons/zfc-rbac/issues/237
I added the ZfcRbac into my application and the guard is blocking my page correctly.
The problem is that the ZF2 Navigation helper does not see the permissions on the page which means it will still show the page. This even though the guard is blocking it.
The ->getPermission() on the page returns null.