public function preDispatch() { if ($this->_getParam('applicationAssetsVersion')) { if (Kwf_Assets_Dispatcher::getAssetsVersion() != $this->_getParam('applicationAssetsVersion')) { $this->_forward('json-wrong-version', 'error', 'kwf_controller_action_error'); return; } } $this->_validateSessionToken(); $allowed = false; if ($this->_getUserRole() == 'cli') { $allowed = true; } else { $acl = Zend_Registry::get('acl'); $resource = $this->getRequest()->getResourceName(); if (!$acl->has($resource)) { throw new Kwf_Exception_NotFound(); } else { if ($this->_getAuthData()) { $allowed = $acl->isAllowedUser($this->_getAuthData(), $resource, 'view'); } else { $allowed = $acl->isAllowed($this->_getUserRole(), $resource, 'view'); } } } if (!$allowed) { $params = array('resource' => $resource, 'role' => $this->_getUserRole()); $this->_forward('json-login', 'login', 'kwf_controller_action_user', $params); } parent::preDispatch(); }