/**
  * @inheritdoc
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['access']['rules'] = [['allow' => true, 'actions' => ['index'], 'roles' => ['adminAssignmentView']], ['allow' => true, 'actions' => ['create'], 'roles' => ['adminAssignmentCreate']], ['allow' => true, 'actions' => ['update'], 'roles' => ['adminAssignmentUpdate']], ['allow' => true, 'actions' => ['delete', 'batch-delete'], 'roles' => ['adminAssignmentDelete']]];
     $behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['index' => ['get'], 'create' => ['get', 'post'], 'update' => ['get', 'put', 'post'], 'delete' => ['post', 'delete'], 'batch-delete' => ['post', 'delete']]];
     return $behaviors;
 }
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['access']['rules'] = ArrayHelper::merge($behaviors['access']['rules'], [['allow' => true, 'actions' => ['index'], 'roles' => ['pageView']], ['allow' => true, 'actions' => ['create'], 'roles' => ['pageCreate']], ['allow' => true, 'actions' => ['update'], 'roles' => ['pageUpdate']], ['allow' => true, 'actions' => ['delete', 'batch-delete'], 'roles' => ['pageDelete']]]);
     $behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['index' => ['get'], 'update' => ['get', 'put', 'post'], 'delete' => ['post', 'delete'], 'batch-delete' => ['post', 'delete']]];
     return $behaviors;
 }
示例#3
0
 public function beforeAction($action)
 {
     if ($action->id == "create-img-ajax" || $action->id == "filemanager" || $action->id == "crop-ajax") {
         $this->enableCsrfValidation = false;
     }
     return parent::beforeAction($action);
 }
示例#4
0
 /**
  * Возвращает список ссылок для левого меню
  * @return array
  */
 public function getLeftMenu()
 {
     $list = parent::getLeftMenu();
     if ($this->action->id === 'update') {
         $list[] = ['label' => 'Удалить', 'url' => ['/admin/education/delete', 'id' => Yii::$app->request->get('id')]];
     }
     return $list;
 }
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['access']['rules'] = [['allow' => true, 'actions' => ['index'], 'roles' => ['BViewComments']]];
     $behaviors['access']['rules'][] = ['allow' => true, 'actions' => ['update'], 'roles' => ['BUpdateComments']];
     $behaviors['access']['rules'][] = ['allow' => true, 'actions' => ['delete', 'batch-delete'], 'roles' => ['BDeleteComments']];
     $behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['index' => ['get'], 'update' => ['get', 'put', 'post'], 'delete' => ['post', 'delete'], 'batch-delete' => ['post', 'delete']]];
     return $behaviors;
 }
 public function beforeAction($action)
 {
     if (parent::beforeAction($action)) {
         if ($action->id == 'error' && Yii::$app->user->isGuest) {
             $this->layout = '//guest';
         }
         return true;
     }
     return false;
 }
示例#7
0
 /**
  * Возвращает список ссылок для левого меню
  * @return array
  */
 public function getLeftMenu()
 {
     $list = parent::getLeftMenu();
     if ($this->action->id === 'update') {
         $list[] = ['label' => 'Удалить', 'url' => ['/admin/user/delete', 'id' => Yii::$app->request->get('id')]];
     }
     if ($this->action->id === 'mailcv') {
         $list = [['label' => 'Резюме', 'url' => ['/admin/user/update', 'id' => Yii::$app->request->get('user_id')]]];
     }
     return $list;
 }
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['access']['rules'] = [];
     $behaviors['access']['rules'][] = ['allow' => true, 'actions' => ['index'], 'roles' => ['userCreate', 'userUpdate', 'userDelete']];
     $behaviors['access']['rules'][] = ['allow' => true, 'actions' => ['create'], 'roles' => ['userCreate']];
     $behaviors['access']['rules'][] = ['allow' => true, 'actions' => ['update'], 'roles' => ['userUpdate']];
     $behaviors['access']['rules'][] = ['allow' => true, 'actions' => ['delete', 'batch-delete'], 'roles' => ['userDelete']];
     $behaviors['access']['rules'][] = ['allow' => true, 'actions' => ['fileapi-upload'], 'roles' => ['userCreate', 'userUpdate', 'userDelete']];
     $behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['index' => ['get'], 'create' => ['get', 'post'], 'update' => ['get', 'put', 'post'], 'delete' => ['post', 'delete'], 'batch-delete' => ['post', 'delete']]];
     return $behaviors;
 }