Inheritance: extends yii\web\Controller
Example #1
0
 public function beforeAction($action)
 {
     if ($action->id == 'view') {
         $this->enableCsrfValidation = false;
     }
     return parent::beforeAction($action);
 }
Example #2
0
 public function init()
 {
     if ($this->model && \Yii::$app->cmsToolbar) {
         $controller = \Yii::$app->createController('cms/admin-tree')[0];
         $adminControllerRoute = ['cms/admin-tree/update', $controller->requestPkParamName => $this->model->{$controller->modelPkAttribute}];
         $urlEditModel = UrlHelper::construct($adminControllerRoute)->enableAdmin()->setSystemParam(\skeeks\cms\modules\admin\Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true')->toString();
         \Yii::$app->cmsToolbar->editUrl = $urlEditModel;
     }
     parent::init();
 }
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['viewAccess' => ['class' => CmsAccessControl::className(), 'only' => ['view'], 'rules' => [['allow' => true, 'matchCallback' => function ($rule, $action) {
         if ($this->model->cmsContent && $this->model->cmsContent->access_check_element == 'Y') {
             //Если такая привилегия заведена, нужно ее проверять.
             if ($permission = \Yii::$app->authManager->getPermission($this->model->permissionName)) {
                 if (!\Yii::$app->user->can($permission->name)) {
                     return false;
                 }
             }
         }
         return true;
     }]]]]);
 }
Example #4
0
 /**
  * @return array
  */
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['accessToView' => ['class' => CmsAccessControl::className(), 'only' => ['view'], 'rules' => [['allow' => true, 'matchCallback' => function ($rule, $action) {
         $id = \Yii::$app->request->get('id');
         $shopOrder = V3toysOrder::findOne($id);
         if (\Yii::$app->user->isGuest) {
             return false;
         }
         if ($shopOrder->user_id == \Yii::$app->user->identity->id) {
             return true;
         }
         return false;
     }]]], 'accessToList' => ['class' => CmsAccessControl::className(), 'only' => ['list'], 'rules' => [['allow' => true, 'roles' => ['@']]]]]);
 }
Example #5
0
 /**
  * @return array
  */
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['verbs' => ['class' => VerbFilter::className(), 'actions' => ['shop-person-type-validate' => ['post'], 'shop-person-type-submit' => ['post']]]]);
 }
Example #6
0
 public function init()
 {
     parent::init();
     self::onceInit();
     if (!$this->name) {
         $this->name = \Yii::t('app', 'The name of the controller');
         //Inflector::humanize($this->id);
     }
     $this->layout = \Yii::$app->cms->moduleAdmin()->layout;
     \Yii::$app->trigger(self::EVENT_INIT, new AdminInitEvent(['name' => self::EVENT_INIT, 'controller' => $this]));
 }
Example #7
0
 public function init()
 {
     parent::init();
 }