Rbam Module Generate Auth Data Issue


I am using RBAM module for the implementation of ACL in my project. I have integrated the module successfully but I am having some issues. In the RBAM Moudule when I click on Generate Auth Data an error appears that I am not able to understand why it is coming. I debugged the issue and the issue is in RbamModule.php file in the getUser function.When I click on the link I am getting this error Call to a member function attachBehavior() on a non-object in \protected\modules\rbam\RbamModule.php on line 426. The code for the function is as follows


	* Returns the user with the specified id.

	* To handle the case of a user logged in to the Yii default application as

	* admin/admin or demo/demo or a similar scenario where the user is not in the

	* db, we use a dummy user to provide the RBAM user name.

	* @param mixed the user id


	public function getUser($id) {

                $criteria = new CDbCriteria;

                $criteria->select = $this->userNameAttribute.',id';

		$user = CActiveRecord::model($this->userClass)->findByPk($id,$criteria);


		if (is_null($user) && !Yii::app()->getUser()->isGuest) {

			$user = CActiveRecord::model($this->userClass);

			$user->{$this->userNameAttribute} = Yii::app()->getUser()->id;


		$user->attachBehavior('RbamUserBehavior', 'RbamUserBehavior');// the issue is in this line.

		return $user;


I am not able to figure out why this issue is coming. Can anybody advice me what I am doing wrong. I am using version 1.6.1 of the module.

Thanks in advance.


The error clarifies that …its getting user object null… now you should find what happened to user object… why its coming as NULL :)

Just try to print the output for below lines

$user = CActiveRecord::model($this->userClass)->findByPk($id,$criteria);