Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
0
 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');
 }
Ejemplo n.º 3
0
 public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
 {
     parent::__construct($request, $response, $invokeArgs);
 }