2amigos / yii2-usuario

Highly customizable and extensible user management, authentication, and authorization Yii2 extension
https://github.com/2amigos/yii2-usuario
Other
294 stars 142 forks source link

Yii::$app->authManager->getRolesByUser(Yii::$app->user->getId()); returns a empty array #449

Open maxxer opened 2 years ago

maxxer commented 2 years ago

for some days after a update $roles = Yii::$app->authManager->getRolesByUser(Yii::$app->user->getId()); returns a empty array

Originally posted by @EndErr in https://github.com/2amigos/yii2-usuario/issues/442#issuecomment-1052043485

maxxer commented 2 years ago

@MatteoF96 could this be related to your recent commits?

squio commented 1 year ago

Please check you have this in your config:

        'authManager' => [
            'class' => 'Da\User\Component\AuthDbManagerComponent',
        ],

I had a similar issue which was caused by the default config to use yii\rbac\DbManager (advanced template); struggled with it for almost a day 😓