I have already extended the webuser and have this code isAdmin()
function isAdmin(){
$user = $this->loadUser(Yii::app()->user->id);
return intval($user->role_id) == 4;
}
$user->role_id will be it’s identifier. In this case role_id=4 is admin.
But isAdmin won’t function… It gives me an error…
Property "WebUser.isAdmin" is not defined.
I have already extended the webuser and have this code isAdmin()
function isAdmin(){
$user = $this->loadUser(Yii::app()->user->id);
return intval($user->role_id) == 4;
}
$user->role_id will be it’s identifier. In this case role_id=4 is admin.
But isAdmin won’t function… It gives me an error…
Property "WebUser.isAdmin" is not defined.
How can I do it like in CRUD… LIKE THIS…
array('allow',
// allow all users to perform 'index' and 'view' actions
'actions'=>array('index','view', 'admin','delete','create','update'),
'users'=>array('IsAdmin'), //instead of 'admin'
),
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions'=>array('create','update'),
'users'=>array('IsRegistere'), //instead of '@'
),
How can I do it like in CRUD… LIKE THIS…
array('allow',
// allow all users to perform 'index' and 'view' actions
'actions'=>array('index','view', 'admin','delete','create','update'),
'users'=>array('IsAdmin'), //instead of 'admin'
),
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions'=>array('create','update'),
'users'=>array('IsRegistere'), //instead of '@'
),
Also added this to my UserIdentity;
else
{
$this->_id=$record->role_id;
if ($this->_id==4)
{
$this->setState('isAdmin', $this->_id);
$this->errorCode=self::ERROR_NONE;
}
}
Why is there still an error?