]> source.dussan.org Git - nextcloud-server.git/commitdiff
Skip over users that have already been shared with when sharing with a group
authorMichael Gapczynski <GapczynskiM@gmail.com>
Wed, 9 May 2012 21:16:31 +0000 (17:16 -0400)
committerMichael Gapczynski <GapczynskiM@gmail.com>
Wed, 9 May 2012 21:16:31 +0000 (17:16 -0400)
apps/files_sharing/lib_share.php

index 3bcc2b562e5280079b2d9e1ecd6f1df6ec034a02..912b5ffdf95b615ee56d40cd543cc4e486e1c230 100755 (executable)
@@ -72,8 +72,13 @@ class OC_Share {
                                $checkSource = OCP\DB::prepare("SELECT source FROM *PREFIX*sharing WHERE source = ? AND uid_shared_with ".self::getUsersAndGroups($uid, false));
                                $resultCheckSource = $checkSource->execute(array($source))->fetchAll();
                                // TODO Check if the source is inside a folder
-                               if (count($resultCheckSource) > 0 && !isset($gid)) {
-                                       throw new Exception("This item is already shared with ".$uid);
+                               if (count($resultCheckSource) > 0) {
+                                       if (!isset($gid)) {
+                                               throw new Exception("This item is already shared with ".$uid);
+                                       } else {
+                                               // Skip this user if sharing with a group
+                                               continue;
+                                       }
                                }
                                // Check if the target already exists for the user, if it does append a number to the name
                                $sharedFolder = '/'.$uid.'/files/Shared';