F
F
Forleyn2015-11-20 17:28:07
Yii
Forleyn, 2015-11-20 17:28:07

How to correctly display additional functionality depending on whether the user is authorized in yii2?

Lyrical digression:
I’m just starting to make websites, and just recently I’ve moved away from stupid video courses, because I have to leave my comfort zone and start developing something myself, but there are many small questions, but I hope they will tell me, I came to what is better to look for solutions to minor problems than to generally say to myself that I don’t know how to do something.
I need to make a simple bulletin board in yii2.

The question itself:

1) Make a different menu
2) Opportunities to comment on the profile or lack thereof
And all this, depending on whether the user is authorized or not.
Is it easy for me through if, depending on whether the user is authorized, to add a form for sending a comment or not directly in the view?
If the user goes without authorization through the link which he himself enters in the browser available only for authorized, where in this case to check whether he is authorized, directly in the controller, or can it be written somewhere in the routing?
I hope you don't lash out at me for childish questions :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2015-11-20
@R0dger

read about RBAC in YII2 you will be surprised what is not there
+ there are rules in the controllers where it is set to run an action for an authorized user, for a role, for everyone, for un. etc.
www.yiiframework.com/doc-2.0/yii-filters-accesscon...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question