Fixing The Login

Hey guys,

Im fairly new to yii and is working on my first project.

I have a small issue with fixing the login, i have several different user levels which can do a specific set of tasks.

I have a login table with fields




How can i create a login so that only the tasks relevant to that particular level is displayed??

Any reading material or any help is greatly appreciated…

Thanks a lot for your time…


Use Rights extension to manage user’s level:

@Fabrizio Caldarelli - Thanks a lot for the reply!

I meddled with Rights extension for a day,and couldnt get the hang of it. So i tried the basic AuthManager, with RBAC stil no luck. :(

in my UserIdentity (my authentication function):-

public function authenticate()


        $record=  Logindetails::model()->findByAttributes(array('Username'=>$this->username));





        else if($record->Password !== $this->password )






            $this->setState('title', $record->title);




        return !$this->errorCode;


Implemented the business rules as :-


                $bizRule='return !Yii::app()->user->isGuest;';

                $auth->createRole('authenticated', 'authenticated user', $bizRule);


                $bizRule='return Yii::app()->user->isGuest;';

                $auth->createRole('guest', 'guest user', $bizRule);

                $role = $auth->createRole('admin', 'administrator');

                $auth->assign('admin',1); // adding admin to first user created

Had my controllers accessRules as :-

 public function accessRules(){

        return array(

        array('allow', // allow anyone to register


              'users'=>array('*'), // all users


        array('allow', // allow authenticated users to update/view




        array('allow', // allow admins only to delete




        array('deny', // deny anything else




But when i logged in as admin i am unable to view or update. 403 error gets thrown :(

Any help is appreciated :)…!

Thanks a lot for your time! :)