It is very easy to set extra value in yii framework $_SESSION. Just follow Line no-15 and 24, 25. The setState() function helps you.
class UserIdentity extends CUserIdentity
{
/**
* Authenticates a user.
* The example implementation makes sure if the username and password
* are both ’demo’.
* In practical applications, this should be changed to authenticate
* against some persistent user identity storage (e.g. database).
* @return boolean whether authentication succeeds.
*/
private $_id;
public function authenticate()
{
$user=UserInfo::model()->findByAttributes(array(‘user_name’=>$this->username));
if($user===null)
$this->errorCode=self::ERROR_USERNAME_INVALID;
else if($user->password!==$this->password)
$this->errorCode=self::ERROR_PASSWORD_INVALID;
else
{
$this->_id = $user->id;
$this->setState(‘userId’, $user->id);
$this->setState(‘typeId’, $user->type);
$this->errorCode=self::ERROR_NONE;
}
return !$this->errorCode;
}
public function getId()
{
return $this->_id;
}
}
সর্বশেষ এডিট : ২১ শে ডিসেম্বর, ২০১১ রাত ১০:৪৫

অনুগ্রহ করে অপেক্ষা করুন। ছবি আটো ইন্সার্ট হবে।




