Authorization Manager with Role-Based Access Control on DB

Hi,

I don't understand very well the Authorization Manager (RBAC) with a DB.

Yii provides two types of authorization managers: CPhpAuthManager and CDbAuthManager.

If i understand, for using CDbAuthManager is necessary :

  1. create on DB 3 tables: AuthAssignment, AuthItem and AuthItemChild. (see /yii/framework/web/auth/schema.sql) 

  2. Defined authorization hierarchy on DB

  3. modify main.php with this

'authComponent'=>array(


            'class'=>'CDbAuthManager',


            'connectionID'=>'db',


        ),
  1. For Access Checking example:


if(Yii::app()->user->checkAccess('administrator'))


{


    ..............


}

But my application doesn't work.

If I use this for checking my authManager

$auth=Yii::app()->authManager;


print_r($auth);


I received



CPhpAuthManager Object ( [authFile] => /var/www/yii-read-only/demos/testauth/protected/data/auth.php [_items:private] => Array ( ) [_children:private] => Array ( ) [_assignments:private] => Array ( ) [_initialized:private] => 1 [_e:private] => )


 

I don't understand.

Is my application using CPhpAuthManager or CDbAuthManager ?

Could you help me to find my error ? 

thanks

C.

Sorry, there's a typo in the Guide: you should change 'authComponent' to 'authManager'. Fixed.

I would like to thank you for your very quick response to my problem