diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-11-17 13:09:13 +0100 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-11-18 11:03:08 +0100 |
commit | 5192641447e0961111fe361666685f4d0dacbbb4 (patch) | |
tree | 62171194af6f5d1e57edb2d8a03662e251f14cda /lib/private/share | |
parent | 230e517f3506624091d19194ce17d43c3f105c88 (diff) | |
download | nextcloud-server-5192641447e0961111fe361666685f4d0dacbbb4.tar.gz nextcloud-server-5192641447e0961111fe361666685f4d0dacbbb4.zip |
make sure that we don't find the wrong shares if a user and a group have the same ID
Diffstat (limited to 'lib/private/share')
-rw-r--r-- | lib/private/share/share.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php index b7b05dab8ef..f9d1de1febf 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -1308,14 +1308,18 @@ class Share extends \OC\Share\Constants { if (isset($shareType)) { // Include all user and group items if ($shareType == self::$shareTypeUserAndGroups && isset($shareWith)) { - $where .= ' AND `share_type` IN (?,?,?)'; + $where .= ' AND ((`share_type` in (?, ?) AND `share_with` = ?) '; $queryArgs[] = self::SHARE_TYPE_USER; - $queryArgs[] = self::SHARE_TYPE_GROUP; $queryArgs[] = self::$shareTypeGroupUserUnique; - $userAndGroups = array_merge(array($shareWith), \OC_Group::getUserGroups($shareWith)); - $placeholders = join(',', array_fill(0, count($userAndGroups), '?')); - $where .= ' AND `share_with` IN ('.$placeholders.')'; - $queryArgs = array_merge($queryArgs, $userAndGroups); + $queryArgs[] = $shareWith; + $groups = \OC_Group::getUserGroups($shareWith); + if (!empty($groups)) { + $placeholders = join(',', array_fill(0, count($groups), '?')); + $where .= ' OR (`share_type` = ? AND `share_with` IN ('.$placeholders.')) '; + $queryArgs[] = self::SHARE_TYPE_GROUP; + $queryArgs = array_merge($queryArgs, $groups); + } + $where .= ')'; // Don't include own group shares $where .= ' AND `uid_owner` != ?'; $queryArgs[] = $shareWith; |