Answer the question
In order to leave comments, you need to log in
How to massively restrict access to actions (authorized access)?
In an action, you have to put this code before all the code
if (Yii::$app->user->isGuest)
{
return $this->redirect(Url::to('/user/sign-in/login'));
}
in some controllers 90% of actions have to put this code, is there a more elegant way?
in Django, for example, before the method you put a comment //login required and that's it
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