Answer the question
In order to leave comments, you need to log in
Why doesn't AccessRule work?
Registered in the behaviors of the SiteController here is such a filter
'access' => [
'class' => AccessControl::class,
'rules' => [
[
'allow' => true,
'roles' => ['@'],
],
[
'actions' => ['login'],
'allow' => true,
'roles' => ['?'],
],
],
'denyCallback' => function($rule, $action) {
return Yii::$app->response->redirect(['site/login']);
},
],
'bootstrap' => ['log', 'access'],
'components' => [
'access' => [
'class' => AccessControl::class,
'rules' => [
[
'allow' => true,
'roles' => ['@'],
],
[
'controllers' => [SiteController::class],
'actions' => ['login'],
'allow' => true,
'roles' => ['?'],
],
],
'denyCallback' => function($rule, $action) {
return Yii::$app->response->redirect(['site/login']);
},
],
and the rule completely stopped working, why? 'controllers' => ['site']
, did not help.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question