How To Set A User As Admin

this is my database


Screenshot from 2013-01-31 13:10:31.png

and this is my authenticate function in UserIdentity.php

public function authenticate()


		$user_email = strtolower($this->username);





		else if(!$users->validatePassword($this->password))



		{	if($users->users_role==1){



			$this->setState('name', $users->users_name);






		return $this->errorCode==self::ERROR_NONE;


How can I set the user having Role=2 is the admin. The above method is not working.

please help me


yii user + rights is the best way to solve this,

try this link

try like this

hope this helps.

try to assign like this after getting the user information by using email


            $this->setState('lastLoginTime', $user->lastLoginTime);