bizrule and checkAccess return false

good night, well, the problem is that I have a bizrule that is


$bizRule='return Yii::app()->user->id==$params["id_usuario"];';

and I do a checkAccess to see if the user can edit the post.




public function actionEditarComentario($id)

	{

         $model=$this->loadModelComentario($id);

         if (Yii::app()->user->checkAccess('actualizaPost',array('id_usuario'=>$model->id_usuario)))

	    {

              //code to edit post

            }

            //code if cant edit post

        }



and this isnt working, first i try to use accesRules doing this




                             array('allow', 

				'actions'=>array('EditarComentario'),

				'roles'=>array('actualizaPost'=>array('id_usuario'=>$model->id_usuario)),



neither work, the thing is that I do this to see if something is wrong:




            echo $model->id_usuario;

	    echo "</br>";

	    echo Yii::app()->user->id;



I get that the ids are identically, also the user have that role, so i dont have any idea about what im doing wrong, please i need a help whit this.

ps:sorry for my english.

<---------------------------------updates------------------------------------------>

I was able to get this work, in my case the problem was that role hasn’t assign the task “actualizaTuPropioPost” that is child “actualizaPost”, so to everyone who have the same problem or any problem with bizrule and roles and checkacces, the correct form, at least to me, is this:




//create roles, task, operation

$auth=Yii::app()->authManager;

$auth->createOperation('actualizaPost','Actualiza un publicacion');


$bizRule='return Yii::app()->user->id==$params["id_usuario"];';

$task=$auth->createTask('ActualizaTuPropioPost','actualiza una publicacion propia',$bizRule);

$task->addChild('actualizaPost');


$role=$auth->createRole('lector');

$role->addChild('ActualizaTuPropioPost');


//controller

public function actionEditarComentario($id)

	{

         $model=$this->loadModelComentario($id);

         if (Yii::app()->user->checkAccess('actualizaPost',array('id_usuario'=>$model->id_usuario)))

	    {

              //code to edit post

            }

            //code if cant edit post

        }