A
A
alex_belouss2017-05-08 14:26:41
Yii
alex_belouss, 2017-05-08 14:26:41

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

1 answer(s)
P
padlyuck, 2017-05-08
@alex_belouss

https://yiiframework.com.ua/ru/doc/guide/2/securit... as one of the options

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question