On an app i switched to db auth management to use a more complex auth system, but now i can’t understand why an user with a parent role fails the check for the child role.
if(Yii::app()->user->checkAccess('Administrator')){
this fails for a Superadmin user
I’ll explain myself:
I have 3 Roles: Normal, Administrator, Superadmin
The superadmin has 2 childs, Normal and Administrator, while administrator has 1, Normal.
Obviously every parent must be able to do everything his child can do.
Here’s the code from Useridentity where i assign the role
...
$this->_id=$myUser->userid;
$this->setState('title', $myUser->access_level);
$auth=Yii::app()->authManager;
if(!$auth->isAssigned($myUser->access_level,$this->_id))
{
if($auth->assign($myUser->access_level,$this->_id))
{
Yii::app()->authManager->save();
}
}