]> source.dussan.org Git - nextcloud-server.git/commitdiff
OC_Group_Backend.php misses function groupexists
authorBart Visscher <bartv@thisnet.nl>
Sun, 15 Apr 2012 14:28:31 +0000 (16:28 +0200)
committerBart Visscher <bartv@thisnet.nl>
Sun, 15 Apr 2012 15:11:03 +0000 (17:11 +0200)
Fix http://bugs.owncloud.org/thebuggenie/owncloud/issues/oc-182

lib/group.php
lib/group/backend.php

index 4ae9302f78b1b97ae4b3a6a2a64f47488d403feb..9b2959d1f73c77cfa3dba3e8a0b4f88679d220ae 100644 (file)
@@ -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;
        }
        
        /**
index b3fc06ac9a87a700eba81c1d6eee2cd07670f39d..d0bc970da734833fd4dd50d90913911eb9d34533 100644 (file)
@@ -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());
+       }
 }