Ejemplo n.º 1
0
 /**
  * returns the available groups
  * @param string $search a search string
  * @return \OC\Group\Group[]
  */
 private function getGroups($search = '')
 {
     if ($this->isAdmin) {
         return $this->groupManager->search($search);
     } else {
         return \OC_SubAdmin::getSubAdminsGroups($this->user);
     }
 }
Ejemplo n.º 2
0
 /**
  * returns the available groups
  * @param string $search a search string
  * @return \OC\Group\Group[]
  */
 private function getGroups($search = '')
 {
     if ($this->isAdmin) {
         return $this->groupManager->search($search);
     } else {
         $groupIds = \OC_SubAdmin::getSubAdminsGroups($this->user);
         /* \OC_SubAdmin::getSubAdminsGroups() returns an array of GIDs, but this
          * method is expected to return an array with the GIDs as keys and group objects as
          * values, so we need to convert this information.
          */
         $groups = array();
         foreach ($groupIds as $gid) {
             $group = $this->groupManager->get($gid);
             if (!is_null($group)) {
                 $groups[$gid] = $group;
             }
         }
         return $groups;
     }
 }