mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Fix the path for users which have an exception for a group share
This commit is contained in:
parent
5580b0e7c0
commit
8294ad71fc
1 changed files with 22 additions and 7 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue