Making Roles for User

I have already extended the webuser and have this code isAdmin()

function isAdmin(){

    $user = $this->loadUser(Yii::app()->user->id);

    return intval($user->role_id) == 4;


$user->role_id will be it’s identifier. In this case role_id=4 is admin.

But isAdmin won’t function… It gives me an error…

Property "WebUser.isAdmin" is not defined.

How can I do it like in CRUD… LIKE THIS…


 // allow all users to perform 'index' and 'view' actions

				'actions'=>array('index','view', 'admin','delete','create','update'),

				'users'=>array('IsAdmin'), //instead of 'admin'


			array('allow', // allow authenticated user to perform 'create' and 'update' actions


				'users'=>array('IsRegistere'), //instead of '@'


Also added this to my UserIdentity;





			if ($this->_id==4)


				$this->setState('isAdmin', $this->_id);




Why is there still an error?