admin logged in as customer

hello my friends,

I need insert one button in my module admin which come in account user.

but my component cuserIdentity of the module return error Property "CWebUser.logNivel" is not defined.

In my module i created a component and a module to work with this login.

View my controller:

//function get id user

public function actionLogarEmpresa($id){

            //new model to this login

            $model=new LoginForm2;


            $eKey = Yii::app()->getSecurityManager()->getEncryptionKey();


            $userEmpresa = Usuarios::model()->findByPk($id);


           $model->username = $userEmpresa->email;

           $model->password =  Yii::app()->getSecurityManager()->decrypt(utf8_decode($userEmpresa->senha), $eKey );

	   $model->rememberMe = 0;


            // new function to this login


                    //retirect to page of the user



                echo CHtml::errorSummary($model);

                echo "<p>usuario = ".$model->username." senha = ".$model->password."</p>";




View CUserIdentity the my module:

class entrarConta extends CUserIdentity


    private $usuario = null;

    private $eKey;


	public function subauthenticate()



            $this->eKey = Yii::app()->getSecurityManager()->getEncryptionKey();









                if(Yii::app()->getSecurityManager()->decrypt(utf8_decode($this->usuario->senha), $this->eKey )!= $this->password){




                     ******This Return Error **************/

                    Yii::app()->user->setState('logNivel', $this->usuario->nivel);

                    Yii::app()->user->setState('cadastro_user', $this->usuario->id_cadastro);


		return !$this->errorCode;









I think it "setState" not use out module.

I managed to solve!

In main created a stateKeyPrefix = ‘xxxx’.

in component modules custom i set:


this works ;)