public function beforeAction($action) { $item_name = AuthItem::constructName($action->controller->id, $action->id); if (!$this->checkAccess($item_name)) { $this->forbidden(); } $this->setTitleAndSaveSiteAction($action); return true; }
public function beforeAction($action) { $item_name = AuthItem::constructName(Yii::app()->controller->id, $action->id); if (!RbacModule::isAllow($item_name)) { $this->forbidden(); } if (isset(Yii::app()->params->save_site_actions) && Yii::app()->params->save_site_actions) { MainModule::saveSiteAction(); } $this->setTitle($action); $this->_setMetaTags($action); return true; }
public function preFilter($filter_chain) { $item_name = AuthItem::constructName($filter_chain->action->controller->id, $filter_chain->action->id); if (Yii::app()->user->checkAccess($item_name)) { $filter_chain->run(); } else { $msg = null; if (YII_DEBUG) { $msg = t('Зарещено!') . ' ' . t($item_name) . '<br/>'; $msg .= CHtml::link('Разрешить для роли "' . Yii::app()->user->role . '"', Yii::app()->createUrl('/rbac/task/allow', array('item_name' => $item_name))); } $filter_chain->action->controller->forbidden($msg); } }