I am developing a site for a tour and travel company. Site defines various roles like admin, agent, members. I want to give access to modules based on the role type. Pl i need urgent help.
what should i change in accessRules() of the controller file
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('*'),
),
);
}
I have attached a screenshot that defines db structure. Text highlighted in bold are table name, text in red are field names and text in blue are values. 4441
Even if i do that i have 3 roles Admin, Agent and Member. I want to give admin,create and delete access to Admin only, Modify access to Agent and view access to all Admin, Agent and Member.
public function defaultAccessRules()
{
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','delete'),
'users'=>array('admin'),
),
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions'=>array('update'),
'users'=>array('Agent'),
),
);
}