How to create access role in yii and where in yii application part ?
I want to create access role in yii application but I have a problem and don't know about where to assign role in yii like I have three department role:
1.admin -: admin have a all access role in our application
2.staff -: staff same of page and access role like to edit or update
3.user -: user have a all access page only viewing in our application
These type of role can set in controller but I can justify where to write all access in yii and how to set access role ,
I try this type code in controller and here I have role in session I cheeked by using this:
admin but this con't access these type page and show error message (anotharization action )
echo Yii::app()->user->getState('roles');
public function accessRules()
{
return array(
array('allow', //allow admin user to perform 'index'&'view' actions
'actions'=>array('index','view'),
'users'=>array('admin'),
'roles'=>array('admin'),
),
);
}
Yii implements a hierarchical RBAC scheme via its CWebApplication ->authManager application component, Take a look at this wiki