Answer the question
In order to leave comments, you need to log in
Yii2 how to specify which controller to apply action in AccessControl?
Here is the code that is written in the AppController from which all the rest are inherited:
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'actions' => ['index'],
'roles' => ['?'],
],
[
'allow' => true,
'roles' => ['@'],
],
],
],
];
}
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