C
C
ch-aqwer2017-08-13 10:30:49
Yii
ch-aqwer, 2017-08-13 10:30:49

Display user role, Yii2?

Good afternoon! Can you please tell me how to display user role in Yii2?
For example, I have an admin and a manager and I need to display this according to who entered.
I did not work with Yii2, but now I need to quickly figure it out.
Thank you in advance!)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Konstantin Malyarov, 2017-08-13
@Konstantin18ko

https://stackoverflow.com/questions/26763298/how-d...
Translating. Everything is available written.

M
Maxim Timofeev, 2017-08-14
@webinar

how to display user role in Yii2?

Depends on how everything is set up for you. yii is a framework, there are hundreds of ways to implement user role storage. How you implemented it is not clear from your question.
I can offer a video on the topic:
channel "yii2 for blondes and dummies"
video rbac in yii2

A
asilischev, 2017-12-01
@asilischev

For example, like this:
The $var variable will contain an array with instances of the yii\rbac\Role class.
Next, we check the presence of the desired role in the array.
Another shorter option:
Where $role is the name of your role/permission.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question