in the user controller i m checking the access if the user has the same id as the updating user id
but its not working
added this in main inside config:
'authManager'=>array(
'class'=>'CDbAuthManager',
'connectionID'=>'db',
//'defaultRoles'=>array('authenticated','guest'),
),
used the dbschema from the Yii framework
added records in authitem:
1:
name= updateOwnUser
bizrule = return Yii::app()->user->id==$prams["user"]->id;
2:
name= user
bizrule =
added this in authitemchild
parent= user
child = updateOwnUser
added this in authassignment
itemname= user
userid= 9
public function actionUpdate($id)
{
$user = $this->loadModel($id);
if(Yii::app()->user->checkAccess('updateOwnUser',array('user'=>$user))){
echo 'inside the rules';
}else{
echo 'rules are failing';
}
done this in rules
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions'=>array('index','update'),
'roles'=>array('user'),
),
but it is failing i don’t know what to do