示例#1
0
 /**
  * Set custom denyCallback
  */
 public function init()
 {
     $this->denyCallback = function () {
         throw new ApiException(Code::USER_PERMISSION_DENIED);
     };
     parent::init();
 }
示例#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);
     }]];
 }
示例#3
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'only' => ['logout'], 'rules' => [['allow' => true, 'roles' => ['user']]]]];
 }
示例#4
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), ['access' => ['class' => AccessControl::className(), 'rules' => [['allow' => true, 'roles' => ['user']]]]]);
 }