[SOLVED] RBAC Using "expression"


i have in the controler the next code


class UsuariosController extends CController


	public function accessRules()


		return array(







and the class Seguridad in folder components



 * Retorna true si el usuario tiene el rol



class Seguridad {

    public function tieneRol($rol){

       $id_rol=Roles::model()->find('nombre=:nombre', array(':nombre'=>$rol));

       $usuRol=UsuarioRoles::model()->find('usu_id_usuario=:id_usuario and rol_id_rol=:id_rol' , array(':id_usuario'=>Yii::user->getState('id_usuario'),':id_rol'=>$id_rol));

       return !($usuRol === null);





when show list view, the page is blank, no show anything

what is bad? ???

sorry for mi spaninglish

I think you should declare your class method as static to properly use it in your code:

public static function tieneRol($rol){

UPD: typo?



and works

thanks DARK


Check the declared function name and the name you call in ‘expression’ key:

class Seguridad {

    public function tieneRol($rol){


Just a little typo :)

yes yes Newbie Newbie