i have implemented module based login from
http://www.yiiframework.com/wiki/89/module-based-login/
by update 2 method and it works fine for me .
Now there is need to access this module as different role,
i implement user level access to this module as described here
http://www.yiiframework.com/wiki/191/implementing-a-user-level-access-system/
i add LevelLookUp class to EWebUser.
when i try to login now a CException
"CWebUser and its behaviors do not have a method or closure named "isAdmin". "
displayed.
it means module is still using CWebUser, but i create my own EWebUser and place it to module/components/EWebUser.php
and code in module config file init method
$this->setImport(array(
'bgadmin.models.*',
'bgadmin.components.*',
));
$this->setComponents(
array(
'errorHandler' => array(
'errorAction' => 'bgadmin/default/error'),
'user' => array(
//'class' => 'CWebUser',
'class' => 'EWebUser',
'loginUrl' => Yii::app()->createUrl('bgadmin/default/index'),
)
));
Problem-
1.why module is still using CWebuser instead of EWebUser ?
RETRY------------
when i change
$this->setComponents(
to
Yii::app()->setComponents(
then it access the EwebUser but not the loginurl as i logged in but now 2 PROBLEMS
1.‘expression’=>‘Yii::app()->user->isAdmin()’ not works but in class EwebUser it return flase.
2.when logout give error "Property "BgadminModule.user" is not defined. "
logout code is
Yii::app()->user->logout(false);
$this->redirect(Yii::app()->getModule('bgadmin')->user->loginUrl);
in previous case logout was working fine.
Please help me.