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);
 }
Esempio n. 2
0
 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;
     }
 }
Esempio n. 3
0
 public function getControllerPath($controller = null)
 {
     if ($controller != null) {
         return parent::getControllerPath() . DS . ucfirst($controller) . '.php';
     }
     return parent::getControllerPath();
 }
Esempio n. 4
0
 public function beforeControllerAction($controller, $action)
 {
     if (parent::beforeControllerAction($controller, $action)) {
         return parent::beforeControllerAction($controller, $action);
     }
     return false;
 }
 /**
  * Module constructor - Builds the initial module data
  *
  *
  * @author vadim
  *
  */
 public function init()
 {
     // If the langauge is set then set the application
     // Language appropriatly
     if (isset($_GET['lang']) && in_array($_GET['lang'], array_keys(Yii::app()->params['languages']))) {
         Yii::app()->setLanguage($_GET['lang']);
     }
     // Convert application name
     Yii::app()->name = Yii::app()->settings->applicationName != '' ? Yii::app()->settings->applicationName : Yii::app()->name;
     // Other settings
     if (count(Yii::app()->params)) {
         foreach (Yii::app()->params as $key => $value) {
             // Skip the ones that does not exists
             if (!Yii::app()->settings->{$key}) {
                 continue;
             }
             // Add them anyways
             Yii::app()->params[$key] = Yii::app()->settings->{$key} != '' ? Yii::app()->settings->{$key} : Yii::app()->params[$key];
         }
     }
     // Convert settings into params
     if (count(Yii::app()->settings->settings)) {
         foreach (Yii::app()->settings->settings as $settingKey => $settingValue) {
             Yii::app()->params[$settingKey] = $settingValue;
         }
     }
     parent::init();
 }
Esempio n. 6
0
 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;
         }
     }
 }
Esempio n. 7
0
 /**
  * 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);
 }
Esempio n. 8
0
 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;
     }
 }
Esempio n. 9
0
 public function __call($name, $parameters)
 {
     // magic for create
     if (preg_match('/^create(.+)$/', $name)) {
         return $this->_instantiateByConfig($name, $parameters);
     }
     return parent::__call($name, $parameters);
 }
 public function init()
 {
     // this method is called when the module is being created
     // you may place code here to customize the module or the application
     // import the module-level models and components
     $this->setImport(array('integration.models.*', 'integration.components.*', 'integration.controllers.*'));
     parent::init();
 }
Esempio n. 11
0
 public function init()
 {
     parent::init();
     $this->setImport(array('admin.components.*', 'admin.models.*'));
     Yii::app()->setComponents(array('errorHandler' => array('class' => 'CErrorHandler', 'errorAction' => 'admin/site/error'), 'user' => array('allowAutoLogin' => false, 'class' => 'BWebUser')));
     //$base_dir = $this->getBasePath();
     //$layoutPath = $base_dir.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'layouts';
     //$this->setLayoutPath($layoutPath);
 }
Esempio n. 12
0
 /**
  * Module constructor - Builds the initial module data
  *
  *
  * @author vadim
  *
  */
 public function init()
 {
     // If the langauge is set then set the application
     // Language appropriatly
     if (isset($_GET['lang']) && in_array($_GET['lang'], array_keys(Yii::app()->params['languages']))) {
         Yii::app()->setLanguage($_GET['lang']);
     }
     parent::init();
 }
Esempio n. 13
0
 public function init()
 {
     parent::init();
     // $this->setImport(array(
     // 	'application.models.*',
     // 	'auth.models.*',
     // 	'auth.components.*',
     // ));
 }
Esempio n. 14
0
 public function beforeControllerAction($controller, $action)
 {
     if (parent::beforeControllerAction($controller, $action)) {
         $controller->layout = 'fronlay';
         return true;
     } else {
         return false;
     }
 }
Esempio n. 15
0
 public function beforeControllerAction($controller, $action)
 {
     if (parent::beforeControllerAction($controller, $action)) {
         $controller->attachAssets();
         return true;
     } else {
         return false;
     }
 }
Esempio n. 16
0
	public function init()
	{
		$this->setImport(array(
			'nfy.models.*',
			'nfy.components.*',
			'users.models.*',
		));
		parent::init();
	}
Esempio n. 17
0
 public function beforeControllerAction($controller, $action)
 {
     if (parent::beforeControllerAction($controller, $action)) {
         $this->layout = 'inside_menu';
         return true;
     } else {
         return false;
     }
 }
Esempio n. 18
0
 public function checkModuleRights(CWebModule $module)
 {
     $items = $module->getAuthItems();
     if (empty($items) || Yii::app()->getUser()->checkAccess(AuthItem::ROLE_ADMIN)) {
         return true;
     }
     foreach ($items as $task) {
         if (Yii::app()->getUser()->checkAccess($task['name'])) {
             return true;
         }
         foreach ($task['items'] as $item) {
             if (Yii::app()->getUser()->checkAccess($item['name'])) {
                 return true;
             }
         }
     }
     return false;
 }
Esempio n. 19
0
 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;
     }
 }
Esempio n. 20
0
 public function init()
 {
     parent::init();
     // this method is called when the module is being created
     // you may place code here to customize the module or the application
     Yii::app()->urlManager->urlSuffix = '';
     Yii::app()->setComponents(array('errorHandler' => array('errorAction' => 'admin4/Site/error')));
     // import the module-level models and components
     $this->setImport(array('admin4.models.*', 'admin4.components.*', 'admin4.controllers.*'));
 }
Esempio n. 21
0
 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;
     }
 }
Esempio n. 22
0
 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;
     }
 }
Esempio n. 23
0
 public function beforeControllerAction($controller, $action)
 {
     if (parent::beforeControllerAction($controller, $action)) {
         // Если что=нибудь понадобится сделать до запуска
         // любого действия любого контроллера - можно сделать здесь
         return true;
     } else {
         return false;
     }
 }
Esempio n. 24
0
 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;
     }
 }
Esempio n. 25
0
 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;
     }
 }
Esempio n. 26
0
 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;
     }
 }
Esempio n. 27
0
 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;
     }
 }
Esempio n. 28
0
 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;
     }
 }
Esempio n. 29
0
 public function beforeControllerAction($controller, $action)
 {
     if (parent::beforeControllerAction($controller, $action)) {
         if (Yii::app()->user->isGuest) {
             throw new CHttpException(403);
         }
         return true;
     } else {
         return false;
     }
 }
Esempio n. 30
0
 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;
     }
 }