简体   繁体   English

Yii2:根据用户角色更改homeUrl

[英]Yii2: Change homeUrl depending on the user role

How can i change the home url depending on the role of the user that is logged in? 如何根据登录用户的角色来更改主URL?

I mean, if user has Role Admin make one homeUrl, if it has another role, set a different home url. 我的意思是,如果用户具有“角色管理员”,则创建一个homeUrl;如果用户具有另一个角色,则设置另一个主URL。

I don't just want to redirect the user to the url after loggin, but make the home url different for each user permission. 我不仅要在登录后将用户重定向到该URL,还要使每个用户权限的主URL不同。

If user is logged and clicked in nav bar brand, it should go to homeurl of that user. 如果登录并单击导航栏品牌中的用户,则应转到该用户的homeurl。

I think my question is not a duplicate because in my case i don't want to just check if user is guest or not. 我认为我的问题不是重复的,因为就我而言,我不想仅检查用户是否为来宾。 I want to check the user permission and based on that set the home url. 我想检查用户权限,并基于此设置主URL。

Assuming REMOTE_USER is getting set you can always based things off of that. 假设正在设置REMOTE_USER,则始终可以根据此进行设置。 You'll need something (cgi, php, etc.) that can access the variable and direct things based off of it. 您将需要一些可以访问变量并基于它进行定向的东西(cgi,php等)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM