Well that post by DroidUser really helped to get a better understanding of CUserIdentity class. Though when I opened the CUserIdentity.php in Yiiroot/framework/ i found that only getter methods for reading id and username has been defined there but not to set them.
public function getId()
{
return $this->username;
}
public function getName()
{
return $this->username;
}
and that both of them return the username you logged in with, though i found a CWebUser class which is also extended by IUserIdentity.
Here you can use
Yii::app()->user->setState('name',$value)
to actually set a field and assign some value to it and a similar getState method to read it.
I think this will solve my problem as all i want to do is to store some user identification values in a system-wide accessible variable.
Any suggestions?