summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorMichael Gapczynski <GapczynskiM@gmail.com>2012-05-09 17:16:31 -0400
committerMichael Gapczynski <GapczynskiM@gmail.com>2012-05-09 17:16:31 -0400
commit98cd98e2e5a4fdf648ad4b517ecdaa1abdb8aa1d (patch)
tree5bd99d8176c01265ce4e1c268fd9a9a1edda8b19 /apps/files_sharing
parentd4636f4b86ada6444ba35346717f77236b99cf2a (diff)
downloadnextcloud-server-98cd98e2e5a4fdf648ad4b517ecdaa1abdb8aa1d.tar.gz
nextcloud-server-98cd98e2e5a4fdf648ad4b517ecdaa1abdb8aa1d.zip
Skip over users that have already been shared with when sharing with a group
Diffstat (limited to 'apps/files_sharing')
-rwxr-xr-xapps/files_sharing/lib_share.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/files_sharing/lib_share.php b/apps/files_sharing/lib_share.php
index 3bcc2b562e5..912b5ffdf95 100755
--- a/apps/files_sharing/lib_share.php
+++ b/apps/files_sharing/lib_share.php
@@ -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';