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 :
-
create on DB 3 tables: AuthAssignment, AuthItem and AuthItemChild. (see /yii/framework/web/auth/schema.sql)
-
Defined authorization hierarchy on DB
-
modify main.php with this
'authComponent'=>array( 'class'=>'CDbAuthManager', 'connectionID'=>'db', ),
- 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.