Ok, i have a problem, but i think it is not so complicated, so it would be great if someone helped me. 1) I have UserController that extends AbstractRestfulController and it works fine. 2) Then i needed to check the permission to access actions of this controller. If I use "checkPermission" method in every controller it works pretty good, but I want to make this method done in a preDispatch event. And here are some problems: I do like this: Module.php
public function onBootstrap(MvcEvent $e)
{
$em = $e->getApplication()->getEventManager();
$em->attach('dispatch', array($this, 'preDispatch'), +100);
}
My method "checkPermission" checks like this (nothing special I think):
if (!$this->isAllowed($role, $this->routeMatch->getParam('controller'), $this->routeMatch->getParam('action'))) {
So the problem: getParam('action') returns null (It means, that in a preDispatch event application doesn't know what action it needs to execute). How can I make it work like I want? Or here is the main question: When does getParam('action') can return value? Only in onDispatch event?