I've read Yii's documentation about "role-based-access-control" but I didn't found where to configure default user roles.
I've add:
'authManager'=>array(
'class'=>'CDbAuthManager',
'connectionID'=>'db',
'defaultRoles'=>array('guest', 'authenticated', 'admin'),
),
to protected/config/main.php
But where I have to put these business rules?
$bizRule='return !Yii::app()->user->isGuest;';
$auth->createRole('authenticated', 'authenticated user', $bizRule);
$bizRule='return Yii::app()->user->isGuest;';
$auth->createRole('guest', 'guest user', $bizRule);
$bizRule='return Yii::app()->user->admin;';
$auth->createRole('admin', 'admin user', $bizRule);
Thanks for any help!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.