Help ? something to include for hasRole


(X Sano 2) #1

Hi there, would you help me,

I tried to use "hasRole" code but does not work, it shows the following error:

Although login and user/role management seems to work. In the user/role management page, this hasRole function does work. Maybe I have to add some line in the configuration files?

Description

YiiBase::include(Role.php) [<a href=‘yiibase.include’>yiibase.include</a>]: failed to open stream: No such file or directory


<?php $this->widget('zii.widgets.CMenu',array(

	'items'=>array(

	array('label'=>'Home', 'url'=>array('/site/index')),

	array('label'=>'Employee', 'url'=>array('/employee')),

	array('label'=>'Contact', 'url'=>array('/site/contact')),

	array('label'=>'Login', 'url'=>array('/user/user/login'), 'visible'=>Yii::app()->user->isGuest),

	array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest),

	array('label'=>'User Management', 'url'=>array('/user/user/admin'), 'visible'=>User::hasRole('admin'))

	),

	)); 

?>

yii version is 1.1.3 and User Management Module version is 0.4.

Thanks, hidenori


(X Sano 2) #2

Sorry, self-resolved.

In protected/config/main.php, I mistyped the following:

‘import’=>array(

application.modules.user.models.*

)

as user.modules.*

After fixed, it worked.