Why after login user keeps both roles guest and user in yii2?
i'm using rbac in yii2 project. When i print
I get an array with two elements: guest and user? Why "guest" role stays at authorized user? Is it normal behavior or I did something wrong?
This is expected. If you add some role to
defaultRoles, it will be always available, regardless of authentication state. From
A list of role names that are assigned to every user automatically without calling assign(). Note that these roles are applied to users, regardless of their state of authentication.