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