diff --git a/lib/group.php b/lib/group.php index 4ae9302f78b1b97ae4b3a6a2a64f47488d403feb..9b2959d1f73c77cfa3dba3e8a0b4f88679d220ae 100644 --- a/lib/group.php +++ b/lib/group.php @@ -255,7 +255,12 @@ class OC_Group { * @return bool */ public static function groupExists($gid){ - return in_array( $gid, self::getGroups()); + foreach(self::$_usedBackends as $backend){ + if ($backend->groupExists($gid)){ + return true; + } + } + return false; } /** diff --git a/lib/group/backend.php b/lib/group/backend.php index b3fc06ac9a87a700eba81c1d6eee2cd07670f39d..d0bc970da734833fd4dd50d90913911eb9d34533 100644 --- a/lib/group/backend.php +++ b/lib/group/backend.php @@ -82,4 +82,16 @@ abstract class OC_Group_Backend { public function implementsActions($actions){ return (bool)($this->getSupportedActions() & $actions); } + + /** + * check if a group exists + * @param string $gid + * @return bool + */ + public function groupExists($gid){ + if(!$backend->implementsActions(OC_GROUP_BACKEND_GET_GROUPS)){ + return false; + } + return in_array($gid, $this->getGroups()); + } }