public function beforeControllerAction($controller, $action) { if (!Yum::hasModule('role')) { throw new Exception('Using the membership submodule requires the role module activated'); } return parent::beforeControllerAction($controller, $action); }
public function beforeControllerAction($controller, $action) { $roles = Rights::getAssignedRoles(Yii::app()->user->Id); // check for single role foreach ($roles as $role) { if (sizeof($roles) == 1 and $role->name == 'parent') { $controller->layout = 'none'; } if (sizeof($roles) == 1 and $role->name == 'student') { $controller->layout = 'studentmain'; } } if (Yii::app()->user->isGuest) { if (Yii::app()->user->loginUrl) { $controller->redirect($controller->createUrl(reset(Yii::app()->user->loginUrl))); } else { $controller->redirect($controller->createUrl('/')); } } else { if (parent::beforeControllerAction($controller, $action)) { // this method is called before any module controller action is performed // you may place customized code here return true; } else { return false; } } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { $aDevController = array('oauth', 'default', 'client', 'session', 'test', 'site'); //not need to authenticate $aPublicController = array('users', 'listings'); //two-legged $this->oauth_init(); if (!in_array($controller->id, $aDevController)) { // $oauth_version = $this->getParam('oauth_version'); // $msg = 'consumerkey'. $this->consumer_key; // throw new CHttpException(401,$msg); // exit(); if (in_array($controller->id, $aPublicController)) { $this->authentication(); } else { $this->authorization(); } } // this method is called before any module controller action is performed // you may place customized code here return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { return parent::beforeControllerAction($controller, $action); } return false; }
/** * The pre-filter for controller actions. * * @param CController $controller the controller * @param CAction $action the action * @return boolean whether the action should be executed. */ public function beforeControllerAction($controller, $action) { if (Yii::app()->user->isGuest) { Yii::app()->user->loginRequired(); } return parent::beforeControllerAction($controller, $action); }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { $array = array('default', 'client'); Yii::app()->params['api_request'] = true; //This is to indicate to some models its an api request(ie:a captcha not to be used in subject add form since is an api request) $arr_controllers = array('v1/live', 'v1/subject'); $arr_action = array('sendcomment', 'add'); //print_r($action); if (in_array($controller->id, $arr_controllers) and in_array($action->id, $arr_action) and $_REQUEST['anonymously'] != '1') { $this->oauth_init(); $oauth_version = $this->getParam('oauth_version'); //oauth 不需要验证 if ($controller->id != 'oauth') { $this->authorization(); } } else { } // this method is called before any module controller action is performed // you may place customized code here return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { $controller->layout = 'fronlay'; return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { $this->layout = 'inside_menu'; return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { $controller->attachAssets(); return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { // this method is called before any module controller action is performed // you may place customized code here return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { Yii::app()->getModule('cruge')->defaultSessionFilter = 'application.modules.usuario.components.USesionCruge'; Yii::app()->user->loginUrl = array('/usuario'); return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { // Если что=нибудь понадобится сделать до запуска // любого действия любого контроллера - можно сделать здесь return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { Yii::app()->getModule('cruge')->defaultSessionFilter = 'application.components.MiSesionCruge'; Yii::app()->user->loginUrl = array('/administrador/ingresar'); return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { // @todo: what to do if user is not loggend in and want to comment? if (parent::beforeControllerAction($controller, $action)) { // this method is called before any module controller action is performed // you may place customized code here return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { if (Yii::app()->user->isGuest && !($controller->getId() == 'user' && $action->getId() == 'login')) { $controller->redirect(array('user/login')); } return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { $controller->module_id = Modules::model()->getModuleIdByCode($this->id); // this method is called before any module controller action is performed // you may place customized code here return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { $dir = CHtml::asset(__DIR__ . '/assets'); Yii::app()->clientScript->registerCssFile($dir . '/style.css'); Yii::app()->clientScript->registerScriptFile($dir . '/common.js'); return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { // this method is called before any module controller action is performed // you may place customized code here Yii::app()->errorHandler->errorAction = 'admin/default/error'; return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { // this method is called before any module controller action is performed // you may place customized code here Yii::app()->widgetFactory->widgets['CBreadcrumbs'] = Yii::app()->widgetFactory->widgets['TbBreadcrumbs'] = array('homeLink' => CHtml::link(t('lang', 'Home'), array('/admin'))); return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { // this method is called before any module controller action is performed // you may place customized code here $controller->layout = 'application.modules.admin.views.layouts.adminlayout'; return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { if (Yii::app()->user->isGuest) { throw new CHttpException(403); } return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { if (!Yii::app()->user->isAdmin) { throw new CHttpException(403, 'You are not authorized to perform this action.'); } return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { if (!($controller->id == 'account' && ($action->id == 'login' || $action->id == 'logout')) && Yii::app()->user->getState('is_admin') == false) { Yii::app()->request->redirect(Yii::app()->createUrl('admin/login')); } return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { if (!Yii::app()->user->isGuest && Users::model()->findByPk(Yii::app()->user->id)->admin == 1) { return true; } else { Controller::redirect('/site/login'); } } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { if (!Yii::app()->user->isGuest) { return true; } else { Controller::redirect('/site/login'); } } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { Yii::app()->getModule('cruge')->defaultSessionFilter = 'application.components.MiSesionCruge'; Yii::app()->getModule('cruge')->afterLogoutUrl = Yii::app()->createUrl('administrador/admin'); Yii::app()->user->loginUrl = Yii::app()->createUrl('administrador/admin/ingresar'); Yii::app()->theme = 'adminlte'; return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { $cs = Yii::app()->clientScript; $cs->registerCssFile('/css/astro.css'); // this method is called before any module controller action is performed // you may place customized code here return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { // this method is called before any module controller action is performed // you may place customized code here Yii::app()->setComponent('frontendUser', Yii::app()->user); Yii::app()->setComponent('user', Yii::app()->adminUser); return true; } else { return false; } }
public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { if (Yii::app()->user->isGuest) { Controller::redirect(Controller::createUrl(Yii::app()->user->loginUrl[0])); } // this method is called before any module controller action is performed // you may place customized code here return true; } else { return false; } }
/** * Performs access check to cache. * This method will check to see if user IP and password are correct if they attempt * to access actions other than "default/login" and "default/error". * @param CController $controller the controller to be accessed. * @param CAction $action the action to be accessed. * @return boolean whether the action should be executed. */ public function beforeControllerAction($controller, $action) { if (parent::beforeControllerAction($controller, $action)) { $route = $controller->id . '/' . $action->id; $publicPages = array('default/login', 'default/error'); if ($this->password !== false && Yii::app()->user->isGuest && !in_array($route, $publicPages)) { Yii::app()->user->loginRequired(); } else { return true; } } return false; }