Yii2 access rules except доступ - exception 'yii\web\ForbiddenHttpException' with message 'Login Required' - Ошибка - Решение
Primary tabs
An Error occurred while handling another error:
exception 'yii\web\ForbiddenHttpException' with message 'Login Required'
В конкретном случае ошибка наблюдается при переносе проекта (сайта) с одной машины на другую.
Решение
В моём случае пришлось поправить behaviors, отменив действие правил для 3 методов (подмассив except):
return [
'access' => [
'class' => AccessControl::className(),
'except' => ['login', 'error', 'index'], // на эти действия правила не распространяются
'rules' => [
[
'actions' => ['signup'],
'allow' => true,
'roles' => ['?'],
],
[
'actions' => ['logout', 'clients', 'advice'],
'allow' => true,
'roles' => ['@'],
],
],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'logout' => ['post'],
],
],
];
}
- Log in to post comments
- 7097 reads