Doub about authentication

Hello Friends

I’m studying Yii and I would like some help about RBAC, I was config the main.php:




'db'=>array(

			'connectionString' => 'mysql:host=localhost;dbname=fidelity',

			'emulatePrepare' => true,

			'username' => 'root',

			'password' => '',

			'charset' => 'utf8',

		),

                'authManager'=>array(

                                'class'=>'CDbAuthManager',

                                'connectionID'=>'db',

                ),



I modify the class UserIdentity to use my class Usuarios and its working.




<?php


/**

 * UserIdentity represents the data needed to identity a user.

 * It contains the authentication method that checks if the provided

 * data can identity the user.

 */

class UserIdentity extends CUserIdentity

{

    private $_id;

    public function authenticate()

    {

        $record=Usuarios::model()->findByAttributes(array('usuario'=>$this->username));

        if($record===null)

            $this->errorCode=self::ERROR_USERNAME_INVALID;

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

            $this->errorCode=self::ERROR_PASSWORD_INVALID;

        else

        {

            $this->_id=$record->id;

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

            $this->errorCode=self::ERROR_NONE;

        }

        return !$this->errorCode;

    }

 

    public function getId()

    {

        return $this->_id;

    }

}



But I don’t know what I need to use RBAC, I was reading this article:

http://www.yiiframework.com/doc/guide/1.1/en/topics.auth

I understand the logic but I don’t know what I need do!

The RBAC is a file? If yes, where I should put it?

After this what I should do?

I’m from Brazil and my english is not very well. Sorry

rbac is a strategy for user auth…

Hello

I know it, but I don´t understand how to use. I need a example. Could someone explain to me?

I found this guide tremendously helpful.