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(); }
public function init() { parent::init(); $this->_helper->viewRenderer->setNoRender(true); $this->_helper->AjaxContext()->addActionContext('get', 'json')->addActionContext('post', 'json')->addActionContext('new', 'json')->addActionContext('edit', 'json')->addActionContext('put', 'json')->addActionContext('delete', 'json')->initContext('json'); }
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array()) { parent::__construct($request, $response, $invokeArgs); }