protected function beforeAction($action) { parent::beforeAction($action); $roles = ['1']; $role = \Yii::app()->user->role; if (array_intersect($role, $roles)) { return true; } else { throw new CHttpException(403, 'Ошибка прав доступа.'); } }
/** * Отображает Расход по указанному идентификатору * * @param integer $id Идинтификатор Расход для отображения * * @return void */ protected function beforeAction($action) { parent::beforeAction($action); if ($action->id == 'create') { $roles = ['1', '2', '3', '4', '5']; $role = \Yii::app()->user->role; if (array_intersect($role, $roles)) { return true; } else { $this->redirect('/'); } } else { $this->redirect('/'); } }
/** * */ public function init() { $this->productRepository = Yii::app()->getComponent('productRepository'); $this->attributeFilter = Yii::app()->getComponent('attributesFilter'); parent::init(); }
public function init() { $this->productRepository = Yii::app()->getComponent('productRepository'); parent::init(); }
/** * */ public function init() { parent::init(); $this->generator = Yii::app()->getComponent('sitemapGenerator'); }
public function init() { Yii::import('application.modules.zendsearch.vendors.*'); require_once 'Zend/Search/Lucene.php'; parent::init(); }
/** * */ public function init() { parent::init(); $this->feedback = Yii::app()->getComponent('feedback'); }
/** * */ public function init() { $this->productRepository = new ProductRepository(); parent::init(); }
protected function beforeAction($action) { $id = Yii::app()->getRequest()->getQuery('service'); $this->service = Yii::app()->getComponent('eauth')->getIdentity($id); return parent::beforeAction($action); }
/** * */ public function init() { $this->cart = Yii::app()->cart; $this->couponManager = Yii::app()->cart->couponManager; parent::init(); }
/** * Инициализируем контроллер: * * @return void **/ public function init() { parent::init(); $this->layout = 'withsidebar'; }