summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/group.php7
-rw-r--r--lib/group/backend.php12
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/group.php b/lib/group.php
index 4ae9302f78b..9b2959d1f73 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 b3fc06ac9a8..d0bc970da73 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());
+ }
}