cinghie / yii2-user-extended

Yii2 User Extended
6 stars 3 forks source link

Set role bugs #12

Closed jweil85 closed 6 years ago

jweil85 commented 6 years ago
public function setRole($role)
    {
        $auth = Yii::$app->authManager;
        $roleObject = $auth->getRole('registered');

        if (!$roleObject) {
            throw new yii\base\InvalidParamException ("There is no role \"$role\".");
        }

        $auth->assign($roleObject, $this->id);
    }

Should replace with code below, otherwise it will force to registered role and ignore configuration. $roleObject = $auth->getRole($role);

cinghie commented 6 years ago

thanks @jweil85