Hi,
I am looking into ways to create a User permission system based on a "role" column in the database table on a user record.
Question one …
Could someone tell me what this is for …
class PostController extends CController
{
......
public function filters()
{
return array(
'accessControl',
);
}
}
As opposed to this …
class PostController extends CController
{
......
public function accessRules()
{
return array(
array('deny',
'actions'=>array('create', 'edit'),
'users'=>array('?'),
),
array('allow',
'actions'=>array('delete'),
'roles'=>array('admin'),
),
array('deny',
'actions'=>array('delete'),
'users'=>array('*'),
),
);
}
}
Question two …
Could someone tell me if this is a good way of producing the access permissions with the "role" column in database table …
class PostController extends CController
{
......
public function accessRules()
{
$role = $userModel->getRole();
return array(
array('deny',
'actions'=>array('create', 'edit'),
'users'=>array('?'),
),
array('allow',
'actions'=>array('delete'),
'roles'=>array($role),
),
array('deny',
'actions'=>array('delete'),
'users'=>array('*'),
),
);
}
}
Question three …
Is there a better way of doing this?