Ivica, on 14 April 2012 - 01:49 AM, said:
I don't see that you created session anywhere in SiteController.php file
sorry i didn't provided complete details
i have created session in useridentity
--------------------------------------
private $_id;
public function authenticate()
{
$users=Agent::model()->findByAttributes(array('A_username'=>$this->username));
if($users===null)
$this->errorCode=self::ERROR_USERNAME_INVALID;
else
{
if($users->A_password!==$this->password)
{
$this->errorCode=self::ERROR_PASSWORD_INVALID;
}
else
{
$this->_id = $users->A_id;
$session=new CHttpSession;//modified
$session->open();
$session['name']=$this->username;//modified
$this->errorCode=self::ERROR_NONE;
}
}
return !$this->errorCode;
}
----------------------------
by the way problem has been resolved now i am able to access session
----------------------------
public function accessRules()
{
$name;
$session=new CHttpSession;//modified
$session->open();
if(isset($session['name']))
{
$name = $session['name'];
}
return array(
array('allow', // allow all users to perform 'index' and 'view' actions
'actions'=>array('index','view'),
//'users'=>array($session['name']),
'users'=>array($name),
--------------------------