Restricting only few actions in zf2 using bjyauthorize

56 views Asked by At

Consider that in a controller we have 10 actions in that 8 actions can be accessed by anyone but remaining two actions should be accessed by particular user roles.

This I tried using by setting Guard\Controller, but using this 10 actions are accessible to all users or 2 restricted actions are able to access particular user roles still I'm not getting how to configure as per my requirement.

1

There are 1 answers

0
Hayk Manasyan On

In Zend Framework there are Event Listener and ACL. You should create ACL for each action and after it catch ROUTE event. Here is the documatation of ACL.

In this URL is step by step tutorial: Zend Framework 2 ACL setup in 5 minutes – tutorial