public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['accessControl'] = $this->accessControlBehavior();
     $behaviors['accessControl']['rules'] = array_merge([['allow' => true, 'actions' => ['grid-view-settings', 'route-to-url'], 'roles' => ['@']]], $behaviors['accessControl']['rules']);
     return $behaviors;
 }
 /**
  * {@inheritDoc}
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['contentNegotiator'] = ['class' => ContentNegotiator::className(), 'formats' => ['application/json' => Response::FORMAT_JSON]];
     $behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['*' => ['GET', 'AJAX'], 'file-upload' => ['POST', 'AJAX']]];
     return $behaviors;
 }
Example #3
0
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['contentNegotiator']['formats']['text/html'] = Response::FORMAT_HTML;
     //        $behaviors['contentNegotiator']['languages'] = [ 'en', 'zh-CN',];
     return $behaviors;
 }
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     // TODO: Change the autogenerated stub
     $behaviors['authenticator'] = ['class' => QueryParamAuth::className(), 'tokenParam' => 'passkey'];
     return $behaviors;
 }
Example #5
0
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['authenticator'] = ['class' => HttpBearerAuth::className()];
     $behaviors['contentNegotiator'] = ['class' => ContentNegotiator::className(), 'formats' => ['application/json' => Response::FORMAT_JSON]];
     return $behaviors;
 }
Example #6
0
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     // TODO: Change the autogenerated stub
     $behaviors['authenticator'] = ['class' => QueryParamAuth::className(), 'tokenParam' => 'passkey'];
     $behaviors[] = ['class' => 'yii\\filters\\ContentNegotiator', 'formats' => ['application/json' => Response::FORMAT_JSON, 'text/html' => Response::FORMAT_HTML]];
     return $behaviors;
 }
Example #7
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['access']['rules'] = [['allow' => true, 'actions' => ['index'], 'roles' => ['BViewRules']]];
     $behaviors['access']['rules'][] = ['allow' => true, 'actions' => ['create'], 'roles' => ['BCreateRules']];
     $behaviors['access']['rules'][] = ['allow' => true, 'actions' => ['delete', 'batch-delete'], 'roles' => ['BDeleteRules']];
     $behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['index' => ['get'], 'create' => ['get', 'post'], 'delete' => ['post', 'delete'], 'batch-delete' => ['post', 'delete']]];
     return $behaviors;
 }
Example #8
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     if (!isset($behaviors['access']['class'])) {
         $behaviors['access']['class'] = AccessControl::className();
     }
     $behaviors['access']['rules'][] = ['allow' => true, 'actions' => ['index', 'view'], 'roles' => ['viewBlogs']];
     $behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['index' => ['get'], 'view' => ['get']]];
     return $behaviors;
 }
 public function behaviors()
 {
     if (is_array($this->_behaviorsData)) {
         return $this->_behaviorsData;
     }
     if (is_callable($this->_behaviorsData)) {
         return call_user_func($this->_behaviorsData, $this);
     }
     return parent::behaviors();
 }
 public function behaviors()
 {
     $rules = [['allow' => true, 'roles' => ['@']]];
     return \yii\helpers\ArrayHelper::merge(parent::behaviors(), ['access' => ['class' => AccessControl::className(), 'rules' => $rules, 'denyCallback' => function ($rule, $action) {
         if (Yii::$app->getUser()->isGuest) {
             Yii::$app->getSession()->addFlash('warning', Yii::t('app', 'La sessione è scaduta, effettua il login'));
             Yii::$app->getUser()->loginRequired();
         }
         throw new ForbiddenHttpException(Yii::t('app', 'Non sei autorizzato a visualizzare questa pagina'));
     }], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['logout' => ['post']]]]);
 }
 /**
  * Returns a list of behaviors that this component should behave as.
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $rulesIps = [];
     if (false === empty(\Yii::$app->params['secret']['allowIPs'])) {
         $rulesIps = \Yii::$app->params['secret']['allowIPs'];
     }
     $behaviors['AccessControl'] = ['class' => 'yii\\filters\\AccessControl', 'denyCallback' => function ($rule, $action) {
         throw new ForbiddenHttpException(\Yii::t('yii', 'You are not allowed to perform this action.'));
     }, 'rules' => [['allow' => true, 'ips' => $rulesIps]]];
     return $behaviors;
 }
Example #12
0
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['file-cache' => ['class' => HttpCache::class, 'only' => ['view', 'get'], 'lastModified' => function () {
         $id = Yii::$app->request->get('id');
         $nocache = Yii::$app->request->get('nocache', false);
         if ($nocache) {
             return time();
         }
         $filename = Yii::$app->fileStorage->get($id);
         return filemtime($filename);
     }]]);
 }
Example #13
0
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['access' => ['class' => AccessControl::className(), 'rules' => [['actions' => ['login', 'error'], 'allow' => true], ['actions' => ['logout', 'index'], 'allow' => true, 'roles' => ['@']]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]], 'bootstrap' => ['class' => ContentNegotiator::className(), 'formats' => ['application/json' => Response::FORMAT_JSON, 'charset' => 'UTF-8'], 'languages' => ['en', 'de']]]);
     /*
     return [
                 'verbs' => [
                     'class' => VerbFilter::className(),
                     'actions' => [
                         'delete' => ['post'],
                     ],
                 ],
             ];
     */
 }
Example #14
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['create' => ['post'], 'update' => ['put', 'post'], 'delete' => ['post', 'delete']]];
     return $behaviors;
 }
Example #15
0
 /**
  * {@inheritdoc}
  */
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['contentNegotiator' => ['class' => ContentNegotiator::className(), 'only' => ['resource'], 'formats' => ['application/json' => Response::FORMAT_JSON]]]);
 }
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['Initcontroller'] = ['class' => InitcontrollerBehavior::className()];
     return $behaviors;
 }
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     return $behaviors;
 }
Example #18
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), [['class' => QueryParamAuth::className()]]);
 }
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]]]);
 }
Example #20
0
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['returnUrl' => ['class' => 'yiier\\returnUrl\\ReturnUrl', 'uniqueIds' => ['site/qrcode', 'site/login', 'user/security/auth']], MeritBehavior::className()]);
 }
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['contentNegotiator' => ['class' => ContentNegotiator::className(), 'formats' => ['application/json' => 'jsonrpc']], 'authenticator' => ['class' => CompositeAuth::className(), 'optional' => ['index'], 'authMethods' => [UserAuth::className(), QueryParamAuth::className(), HttpBearerAuth::className()]], 'corsFilter' => ['class' => Cors::className()]]);
 }
Example #22
0
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['accessControl' => $this->accessControlBehavior(), 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]]]);
 }
Example #23
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['accessControl' => ['class' => AuthControl::className(), 'rules' => [['allow' => true, 'roles' => ['@'], 'actions' => ['index']], ['allow' => true, 'roles' => ['createProject'], 'actions' => ['create']], ['allow' => true, 'roles' => ['updateProject'], 'actions' => ['update']], ['allow' => true, 'roles' => ['deleteProject'], 'actions' => ['delete'], 'verbs' => ['POST']]]]]);
 }
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['index' => ['get'], 'view' => ['get'], 'create' => ['get', 'post'], 'edit' => ['put', 'post'], 'delete' => ['post', 'delete'], 'batch-delete' => ['post', 'delete']]];
     return $behaviors;
 }
Example #25
0
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['corsFilter' => ['class' => \yii\filters\Cors::className(), 'cors' => ['Origin' => ['*'], 'Access-Control-Request-Method' => ['POST', 'PUT', 'GET'], 'Access-Control-Request-Headers' => ['X-Wsse'], 'Access-Control-Allow-Credentials' => true, 'Access-Control-Max-Age' => 3600, 'Access-Control-Expose-Headers' => ['X-Pagination-Current-Page']]]]);
 }
Example #26
0
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['access-no-guests' => ['class' => CmsAccessControl::className(), 'rules' => [['allow' => true, 'roles' => ['@']]]], 'verbs' => ['class' => VerbFilter::className(), 'actions' => ['upload' => ['post'], 'remote-upload' => ['post'], 'link-to-model' => ['post'], 'link-to-models' => ['post']]]]);
 }
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['bootstrap' => ['class' => ContentNegotiator::className(), 'formats' => ['application/json' => Response::FORMAT_JSON, 'charset' => 'UTF-8'], 'languages' => ['en', 'de']]]);
 }
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['access' => ['class' => AccessControl::className(), 'rules' => [['allow' => true, 'roles' => ['@']]]]]);
 }
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['authenticator'] = ['class' => CompositeAuth::className(), 'authMethods' => [QueryParamAuth::className()]];
     return $behaviors;
 }
Example #30
-1
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     /*return [
           'access' => [
               'class' => AccessControl::className(),
               'rules' => [
                   [
                       'actions' => ['login', 'error'],
                       'allow' => true,
                   ],
                   [
                       'actions' => ['logout', 'index'],
                       'allow' => true,
                       'roles' => ['@'],
                   ],
               ],
           ],
           'verbs' => [
               'class' => VerbFilter::className(),
               'actions' => [
                   'logout' => ['post'],
               ],
           ],
       ];*/
     parent::behaviors();
 }