Yii_user and Rights ext. combined issue

when i am using both extension Yii User and Rights than i will be not able to save my profile edit.

[size="4"]config main.php [/size][size="4"] componet like below for using rights plugin.[/size]

‘components’=>array(

	'user'=>array(


		'class'=>[b]'RWebUser',[/b]


    	'allowAutoLogin'=>true,


    	'loginUrl' => array('/user/login'),


	),

now i am able to access all Rights extension related featurs but not able to save my profile edits. getting following error:-

[size="3"]CException[/size]

RWebUser and its behaviors do not have a method or closure named "updateSession".

C:\wamp\www\yii\framework\base\CComponent.php(266) 254 public function __call($name,$parameters) 255 { 256 if($this->_m!==null) 257 { 258 foreach($this->_m as $object) 259 { 260 if($object->getEnabled() && method_exists($object,$name)) 261 return call_user_func_array(array($object,$name),$parameters); 262 } 263 } 264 if(class_exists(‘Closure’, false) && $this->canGetProperty($name) && $this->$name instanceof Closure) 265 return call_user_func_array($this->$name, $parameters); 266 throw new CException(Yii::t(‘yii’,’{class} and its behaviors do not have a method or closure named “{name}”.’, 267 array(’{class}’=>get_class($this), ‘{name}’=>$name))); 268 }

[size="4"]Again when i changed my config main.php component to :[/size]

‘components’=>array(

	'user'=>array(


		'class'=>[b]'WebUser',[/b]


    	'allowAutoLogin'=>true,


    	'loginUrl' => array('/user/login'),


	),

now i am able to save my profile edit but not able to access few of my my Rights plugin features.

Using Yii 1.1.10

I was facing the same problem as well.

The path to "localhost/testdrive/user/admin/update" works fine. But when I try to execute "localhost/testdrive/user/profile/edit" I get the same error mentioned above.

I was able to solve the problem by adding this function that I found under /modules/user/components/WebUser.php to the file /modules/rights/components/CWebUser.php


public function updateSession() 

{

$user = Yii::app()->getModule('user')->user($this->id);

$userAttributes = CMap::mergeArray(array(												'email'=>$user->email,

												'username'=>$user->username,

											'create_at'=>$user->create_at,

											'lastvisit_at'=>$user->lastvisit_at,

										   ),$user->profile->getAttributes());


foreach ($userAttributes as $attrName=>$attrValue) 

{

$this->setState($attrName,$attrValue);

}

}

Hope this helps.

Thanks madi done.

Thanks Madi, this solved my problem as well. But I’m also curious as to why this happened.

The excetion thrown says everything.

RWebUser is apparently missing the updateSession behaviour.

Or, RWebUser can just extend WebUser from Yii_user ext by simply replacing in RWebUser (9) :


class RWebUser extends CWebUser

with :


class RWebUser extends WebUser

Cheers!

i’ve added function updateSession() in /modules/rights/components/RWebUser.php, i don’t have /modules/rights/components/CWebUser.php

I am in the same boat, no CWebUser. & when I added to RWebUser no luck :’(

Can we just copy/paste the SQL file under modules > rights > data > schema.sql? Or is there more to the install process?

Cheers!

This problem has already been solved with CBehaviors in this github repo schmunk42/web-user-behavior