Esempio n. 1
0
 /**
  * Set custom denyCallback
  */
 public function init()
 {
     $this->denyCallback = function () {
         throw new ApiException(Code::USER_PERMISSION_DENIED);
     };
     parent::init();
 }
Esempio n. 2
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'rules' => [['allow' => true, 'roles' => ['user']]], 'denyCallback' => function () {
         throw new ApiException(Code::USER_PERMISSION_DENIED);
     }]];
 }
Esempio n. 3
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'only' => ['logout'], 'rules' => [['allow' => true, 'roles' => ['user']]]]];
 }
Esempio n. 4
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['access' => ['class' => AccessControl::className(), 'rules' => [['allow' => true, 'roles' => ['user']]]]]);
 }