示例#1
0
 /**
  * Initialization
  * Set default values
  * @return void
  */
 public function init()
 {
     parent::init();
     if ($this->item !== null) {
         $auth = Yii::$app->authManager;
         $children = $auth->getChildren($this->item->name);
         foreach ($children as $child) {
             if ($child->type == $child::TYPE_ROLE) {
                 $this->roles[] = $child->name;
             } else {
                 $this->permissions[] = $child->name;
             }
         }
         $this->users = $auth->getUserIdsByRole($this->item->name);
     }
 }