Check Zend Navigation page permissions with ZfcRbac

0 Flares Twitter 0 Facebook 0 LinkedIn 0 0 Flares ×

Define your navigation adding pages and permissions:

 

Configure your guards and role_providers for ZfcRbac:

 

Create a Listener:

 

Create a Factory for the RbacListener:

 

Add your RbacListenerFactory to your ServiceManager;

 

And finally attach an event to the isAllowed method of the Zend Navigation View Helper:

 

Now, if you render your navigation inside your layout only the pages the user role is permitted to see should be rendered.

 

Backlinks:

 

Web Deviloper

  • Jonathan Greco

    really nice, thanks..