Unknown Error in RBAC

[b]Call to a member function checkAccess() on a non-object


I dont Know why i get this error, But Last week this piece of code works. I am using Yii 2.0.6.

public static function validate(){

        if ( !Yii::$app->user->isGuest) {

            $urlData = Yii::$app->controller->id."/".Yii::$app->controller->action->id;

            if ( !Yii::$app->user->can($urlData) ) {


                //throw new ForbiddenHttpException();




        return true;


Above function runs in beforeAction of every controllers actions.



That error is because the method getAuthManager return null. In the last week you modify the config/web.php ?

Thank You :D . Yes You are correct, I am forgot to uncomment the below line config/mian.php

'authManager' => [

    'class' => 'yii\rbac\DbManager',

    'defaultRoles' => ['guest'],


I had the same error :lol: