Answer the question
In order to leave comments, you need to log in
Can I make AccessControl access rights for different roles in the config for all controllers?
I found such a way as in the config to restrict all roles except the admin access to the admin panel
'as access' => [
'class' => 'yii\filters\AccessControl',
'except' => ['site/login', 'site/error'],
'rules' => [
[
'allow' => true,
'roles' => ['admin'],
],
],
],
'as access' => [
'class' => 'yii\filters\AccessControl',
'rules' => [
[
'actions' => ['site/login', 'site/error'],
'allow' => true,
'roles' => ['admin'],
],
[
'actions' => ['user/index', 'user/view'],
'allow' => true,
'roles' => ['moderator'],
],
],
],
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