Execute my code before any action of any controller

后端 未结 5 1612
我寻月下人不归
我寻月下人不归 2020-12-05 00:21

I would like to check if my user have filled certain fields in his profile before he can access any action of any controller. For example

if(empty(field1) &         


        
5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-05 00:54

    Or, https://github.com/yiisoft/yii2/blob/master/docs/guide/security-authorization.md use RBAC, to restrict access to controllers actions one at a time based on rules. Why would you want to restrict access to controller actions based on user fields is beyond me. You will not be able to access anything (including the login form) if you put a restriction there.

提交回复
热议问题