You effectively have 2 options:

First, and I am sure least favorite option from a framework perspective: Put your acl check in an onDispatch() method inside of the routed controller (that means at least a controller was dispatched). Inside of this method, you could do whatever check you need. At this point, you'd make sure to call parent::onDispatch() as it is responsible for calling the appropriate action. This is all assuming you're extending the AbstractActionController.

THE BETTER SOLUTION:

Is to get familiar with Event system, write a listener and listen in on a particular event. I think this list is up to day and complete (but I am not sure, best to check in IRC with Rob or Evan):

  http://akrabat.com/zend-framework-2/a-list-of-zf2-events/

  also:
  http://akrabat.com/zend-framework-2/an-introduction-to-zendeventmanager/

  the actual event manager:

http://framework.zend.com/manual/2.0/en/modules/zend.event-manager.event-manager.html

Hope this helps get you started,
Ralph


On 9/11/12 9:12 AM, Ralf Eggert wrote:
Hi Marc,

Marc Tempelmeier schrieb am 11.09.2012 08:56:
in ZF1 I solved this with checking if the route is dispatchable and if not 
screw the whole ACL check. I didn“t check if there is something like that in 
ZF2 though.

I did not find any isDispatchable method yet though I think it is not there.

So I am still looking for a solution.

Regards,

Ralf



--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to