RBAC - using expression

Hi

I have the following code




public function accessRules()

        {

                return array(


                        array('allow',  

                                'actions'=>array('admin','update'),

                                'expression'=>Seguridad::tieneRol('PER_CONSULTA') 

                                ,

............



Seguridad::tieneRol(‘PER_CONSULTA’) return true or false

in 1.0.x work fine, but not in 1.1

the problem is in class CComponent, public function evaluateExpression($expression,$data=array())




public function evaluateExpression($_expression_,$_data_=array())

        {

                if(is_string($_expression_))

                {

                        extract($_data_);

                        return @eval('return '.$_expression_.';');

                }

                else

                {

                        $_data_[]=$this;

                        return call_user_func_array($_expression_, $_data_);

                }

        }



The function receives the result of the expression (numeric) and the funtion check for "is_string"

is a bug? or I’m doing something wrong?

for more datail see http://www.yiiframework.com/forum/index.php?/topic/6886-role-based-authentication/

posible solution

add "or is_numeric($expression)"

i change

‘expression’=>Seguridad::tieneRol(‘PER_CONSULTA’)

by

‘expression’=>“Seguridad::tieneRol(‘PER_CONSULTA’)”

and work

I only have to change each controller, no problem :(