Ejemplo n.º 1
0
 public function beforeInvoke($allowed = [])
 {
     if ($this->_allowGuestTransaction === true) {
         $this->_allowedActions[] = $this->getAction();
     }
     Ajde_Cache::getInstance()->disable();
     return parent::beforeInvoke();
 }
Ejemplo n.º 2
0
 /**
  * Optional function called before controller is invoked
  * When returning false, invocation is cancelled.
  *
  * @return bool
  */
 public function beforeInvoke($allowed = [])
 {
     // set admin layout
     Ajde::app()->getDocument()->setLayout(new Ajde_Layout(config('layout.admin')));
     // disable cache and auto translations
     Ajde_Cache::getInstance()->disable();
     Ajde_Lang::getInstance()->disableAutoTranslationOfModels();
     return parent::beforeInvoke($allowed);
 }
 public function beforeInvoke()
 {
     $crud = $this->getCrudInstance();
     if (!$crud && Ajde::app()->getRequest()->has('crudId')) {
         Ajde_Model::registerAll();
         $session = new Ajde_Session('AC.Crud');
         $crud = $session->getModel(Ajde::app()->getRequest()->getParam('crudId'));
     }
     if ($crud) {
         /* @var $crud Ajde_Crud */
         $this->setAclParam($crud->getSessionName());
     }
     return parent::beforeInvoke();
 }
Ejemplo n.º 4
0
 public function beforeInvoke($allowed = [])
 {
     // disable cache and auto translations
     Ajde_Cache::getInstance()->disable();
     Ajde_Lang::getInstance()->disableAutoTranslationOfModels();
     // try to get the crud instance
     $crud = $this->hasCrudInstance() ? $this->getCrudInstance() : false;
     if (!$crud && Ajde::app()->getRequest()->has('crudId')) {
         $session = new Ajde_Session('AC.Crud');
         $crud = $session->getModel(Ajde::app()->getRequest()->getParam('crudId'));
     }
     if ($crud) {
         /* @var $crud Ajde_Crud */
         $this->setAclParam($crud->getSessionName());
     }
     return parent::beforeInvoke();
 }
Ejemplo n.º 5
0
 public function beforeInvoke($allowed = [])
 {
     $token = Ajde::app()->getRequest()->getParam('token', false);
     if ($token) {
         $user = new UserModel();
         list($uid, $hash) = explode(':', $token);
         if ($user->loadByPK($uid)) {
             if ($user->getCookieHash(false) === $hash) {
                 $user->login();
             }
         }
     }
     $user = UserModel::getLoggedIn();
     if ($user) {
         return parent::beforeInvoke($allowed);
     }
     Ajde::app()->getRequest()->set('message', trans('You may not have the required permission to view this page'));
     Ajde::app()->getResponse()->dieOnCode(Ajde_Http_Response::RESPONSE_TYPE_UNAUTHORIZED);
 }
 public function beforeInvoke()
 {
     Ajde::app()->getDocument()->setTitle("Samples");
     return parent::beforeInvoke();
 }