Checkaccess Causing A Php Warning

Hi. I am new to Yii and I am trying to create an application where one user should have access to different pages/modules. User A can access 1,2,4 while user B can acces 2,3 for example.

But every time I am calling “if(Yii::app()->user->checkAccess(‘SOMETHING’))” it always break the page with an PHP warning.

"include(CdbAuthManager.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory"

I have looked everywhere and can not find what is causing this or what I am doing wrong. Maybe I’m just stupid, this problem have followed me a couple of days now.

I have a table “authassignment” in my database with column “ithemname” = “SuperAdmin” and “userid” = “1”. From what I understand I should be able to use “if(Yii::app()->user->checkAccess('SuperAdmin '))” and when I am logged in as user 1 it should return true?

And to give a new user access to a new controller I could simple add this usersID to the table Authassignment and the userId? Or maybe I have compleatly missunderstood?

Also in my UserController.php I have a function called accessRules. It looks like this:


public function accessRules()

  return array(

    array('allow',  // allow all users to perform 'index' and 'view' actions

      'actions'=>array('index','view'),

        'users'=>array('*'),

    ),

    array('allow', // allow authenticated user to perform 'create' and 'update' actions

      'actions'=>array('create','update'),

      'users'=>array('@'),

    ),

    array('allow', // allow admin user to perform 'admin' and 'delete' actions

      'actions'=>array('admin','delete'),

      'users'=>array('admin'),

    ),

    array('deny',  // deny all users

      'users'=>array('*'),

    ),

  );

}

If I log in with username "admin" (username admin is ID 1 in my database table user) I got access to the controller. But if I change username to lets say "admins" I am refused access again. It looks to me that this takes the username and not the role. Is this what it is supoce to do?

Shortly:

How do I best create an accesscheck to see if user A have access to ithem 2?

Your capitalisation is wrong on CDbAuthManager. Check in the config where you’ve configured it.

Thanks a lot. I must have been blind.