rbac/Rbac.php
public function setAdminRole($user) {
    $classes = $this->loadClasses();

    $auth = Yii::$app->authManager;
    $auth->revokeAll($user->id);

    foreach ($classes as $item) {
      foreach ($item->adminRoles() as $role) {
        $auth->assign($auth->getRole($role), $user->id);
      }
    }

  }
public function setAdminRole($user) {
    $classes = $this->loadClasses();

    $auth = Yii::$app->authManager;
    $auth->revokeAll($user->id);

    foreach ($classes as $item) {
      foreach ($item->adminRoles() as $role) {
        $auth->assign($auth->getRole($role), $user->id);
      }
    }

  }
public function setAdminRole ( $ user ) { $ classes = $ this -> loadClasses ( ) ; $ auth = Yii :: $ app -> authManager ; $ auth -> revokeAll ( $ user -> id ) ; foreach ( $ classes as $ item ) { foreach ( $ item -> adminRoles ( ) as $ role ) { $ auth -> assign ( $ auth -> getRole ( $ role ) , $ user -> id ) ; } } }
Set admin roles to user

@param $user User
Set admin roles to user