]> source.dussan.org Git - nextcloud-server.git/commitdiff
make sure the group exists in the backend before adding a user to it
authorRobin Appelman <icewind@owncloud.com>
Wed, 16 May 2012 22:47:43 +0000 (00:47 +0200)
committerRobin Appelman <icewind@owncloud.com>
Wed, 16 May 2012 22:47:43 +0000 (00:47 +0200)
lib/group.php

index 9b2959d1f73c77cfa3dba3e8a0b4f88679d220ae..1e0216a932b93a47bb18f481569eeee1ab708fb5 100644 (file)
@@ -177,7 +177,11 @@ class OC_Group {
                                if(!$backend->implementsActions(OC_GROUP_BACKEND_ADD_TO_GROUP))
                                        continue;
 
-                               $succes|=$backend->addToGroup($uid, $gid);
+                               if($backend->groupExists($gid)){
+                                       $succes|=$backend->addToGroup($uid, $gid);
+                               }
+                       }
+                       if($succes){
                                OC_Hook::emit( "OC_User", "post_addToGroup", array( "uid" => $uid, "gid" => $gid ));
                        }
                        return $succes;