コード例 #1
0
ファイル: ShopController.php プロジェクト: nabble/ajde
 public function beforeInvoke($allowed = [])
 {
     if ($this->_allowGuestTransaction === true) {
         $this->_allowedActions[] = $this->getAction();
     }
     Ajde_Cache::getInstance()->disable();
     return parent::beforeInvoke();
 }
コード例 #2
0
ファイル: AdminController.php プロジェクト: nabble/ajde
 /**
  * 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);
 }
コード例 #3
0
 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();
 }
コード例 #4
0
ファイル: _coreCrudController.php プロジェクト: nabble/ajde
 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();
 }
コード例 #5
0
ファイル: Controller.php プロジェクト: nabble/ajde
 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);
 }
コード例 #6
0
 public function beforeInvoke()
 {
     Ajde::app()->getDocument()->setTitle("Samples");
     return parent::beforeInvoke();
 }