[Pkg-owncloud-commits] [owncloud] 42/131: Fix the path for users which have an exception for a group share
David Prévot
taffit at moszumanska.debian.org
Tue Aug 11 15:58:29 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v8.1.1
in repository owncloud.
commit c73f938ff4d844d2a444835eb2c131b266fe1eb5
Author: Joas Schilling <nickvergessen at owncloud.com>
Date: Thu Jul 2 11:37:19 2015 +0200
Fix the path for users which have an exception for a group share
---
lib/private/share/share.php | 29 ++++++++++++++++++++++-------
1 file changed, 22 insertions(+), 7 deletions(-)
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index af7f78b..2dc83bd 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;
+ }
}
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list