Yii Srbac extension in the "User has been authorized" point drop-down box, when you select a user who has permissions, you cannot list permissions at all.
The reason is that srbac the ID in the database table to the number, like 123, but if it's not a number like ' y0f22ffc2fef712fd602a1ef64ab319t '. Then this is not going to come out, then you can only modify the code.
Modify the Actionshowassignments method in the \protected\modules\srbac\controllers\authitemcontroller.php file
The source code is as follows
Public functionactionshowassignments () {$userid=isset($_get["id"]) ?$_get["id"]:$_post[Helper::findmodule (' Srbac ')->userclass] [$this->module->UserID]; $user=$this->module->getusermodel ()->FINDBYPK ($userid); $username=$user->{$this->module->username}; $r=Array(0 =Array(0 =Array())); if($userid> 0) { $auth= Yii::app ()AuthManager; /*@var $auth Cdbauthmanager*/ $ass=$auth->getauthitems (2,$userid); $r=Array(); foreach($ass as $i=$role) { $curRole=$role-name; $r[$i] =$curRole; $children=$auth->getitemchildren ($curRole); $r[$i] =Array(); foreach($children as $j=$task) { $curTask=$task-name; $r[$i][$j] =$curTask; $grandchildren=$auth->getitemchildren ($curTask); $r[$i][$j] =Array(); foreach($grandchildren as $k=$oper) { $curOper=$oper-name; $r[$i][$j][$k] =$curOper; } } } //Add always allowed Opers $r["Alwaysallowed"] [""] =$this->module->getalwaysallowed (); $this->renderpartial (' userassignments ',Array(' Data ' =$r, ' username ' =$username)); } }
We modify the 7th line of the judgment statement under if ($userid > 0)
Modify the If (count ($user) > 0), and the modified code is as follows
Public functionactionshowassignments () {$userid=isset($_get["id"]) ?$_get["id"]:$_post[Helper::findmodule (' Srbac ')->userclass] [$this->module->UserID]; $user=$this->module->getusermodel ()->FINDBYPK ($userid); $username=$user->{$this->module->username}; $r=Array(0 =Array(0 =Array())); if(Count($user) > 0) { $auth= Yii::app ()AuthManager; /*@var $auth Cdbauthmanager*/ $ass=$auth->getauthitems (2,$userid); $r=Array(); foreach($ass as $i=$role) { $curRole=$role-name; $r[$i] =$curRole; $children=$auth->getitemchildren ($curRole); $r[$i] =Array(); foreach($children as $j=$task) { $curTask=$task-name; $r[$i][$j] =$curTask; $grandchildren=$auth->getitemchildren ($curTask); $r[$i][$j] =Array(); foreach($grandchildren as $k=$oper) { $curOper=$oper-name; $r[$i][$j][$k] =$curOper; } } } //Add always allowed Opers $r["Alwaysallowed"] [""] =$this->module->getalwaysallowed (); $this->renderpartial (' userassignments ',Array(' Data ' =$r, ' username ' =$username)); } }
You can see the effect after the change, the effect is as follows
If you do not understand why, you can analyze the source code.
The user has been authorized in the SRBAC extension of Yii cannot be viewed