diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2015-07-02 11:37:19 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2015-07-02 15:35:31 +0200 |
commit | 8294ad71fcbf69960b7d6009f077ceb3c6d00168 (patch) | |
tree | 4c3ed94b18c0c13639aa5968ac68188886543c08 /lib/private | |
parent | 5580b0e7c0856c338d5ca975e5654a1207ad4dde (diff) | |
download | nextcloud-server-8294ad71fcbf69960b7d6009f077ceb3c6d00168.tar.gz nextcloud-server-8294ad71fcbf69960b7d6009f077ceb3c6d00168.zip |
Fix the path for users which have an exception for a group share
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/share/share.php | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php index af7f78b9ff5..2dc83bdcc45 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -142,15 +142,25 @@ class Share extends Constants { while ($source !== -1) { // Fetch all shares with another user - $query = \OC_DB::prepare( - 'SELECT `share_with`, `file_source`, `file_target` + if (!$returnUserPaths) { + $query = \OC_DB::prepare( + 'SELECT `share_with`, `file_source`, `file_target` + FROM + `*PREFIX*share` + WHERE + `item_source` = ? AND `share_type` = ? AND `item_type` IN (\'file\', \'folder\')' + ); + $result = $query->execute(array($source, self::SHARE_TYPE_USER)); + } else { + $query = \OC_DB::prepare( + 'SELECT `share_with`, `file_source`, `file_target` FROM `*PREFIX*share` WHERE - `item_source` = ? AND `share_type` = ? AND `item_type` IN (\'file\', \'folder\')' - ); - - $result = $query->execute(array($source, self::SHARE_TYPE_USER)); + `item_source` = ? AND `share_type` IN (?, ?) AND `item_type` IN (\'file\', \'folder\')' + ); + $result = $query->execute(array($source, self::SHARE_TYPE_USER, self::$shareTypeGroupUserUnique)); + } if (\OCP\DB::isError($result)) { \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage(), \OC_Log::ERROR); @@ -182,7 +192,12 @@ class Share extends Constants { $shares = array_merge($shares, $usersInGroup); if ($returnUserPaths) { foreach ($usersInGroup as $user) { - $fileTargets[(int) $row['file_source']][$user] = $row; + if (!isset($fileTargets[(int) $row['file_source']][$user])) { + // When the user already has an entry for this file source + // the file is either shared directly with him as well, or + // he has an exception entry (because of naming conflict). + $fileTargets[(int) $row['file_source']][$user] = $row; + } } } } |