summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-01-19 12:34:28 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-01-19 12:34:28 +0100
commitd2d6472e39144f1dfe5915bf8c11119fc8dcdd4b (patch)
treed3899715948611b823d8249d79820d877ed547d0 /lib
parentd75af7ddd29179a6f22b1ee46efd3c8df9dd09a9 (diff)
parent40931a8b0d5d10c0f711756a4e8a423ff055621e (diff)
downloadnextcloud-server-d2d6472e39144f1dfe5915bf8c11119fc8dcdd4b.tar.gz
nextcloud-server-d2d6472e39144f1dfe5915bf8c11119fc8dcdd4b.zip
Merge pull request #13423 from owncloud/share-fixfindshareforuserwithmultiplegroups
Fix getItemSharedWithUser for groups
Diffstat (limited to 'lib')
-rw-r--r--lib/private/share/share.php27
1 files changed, 18 insertions, 9 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index f61f65f35a7..e85f9f06ed3 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -337,17 +337,26 @@ class Share extends \OC\Share\Constants {
if(empty($shares) && $user !== null) {
$groups = \OC_Group::getUserGroups($user);
- $query = \OC_DB::prepare(
- 'SELECT *
- FROM
- `*PREFIX*share`
- WHERE
- `' . $column . '` = ? AND `item_type` = ? AND `share_with` in (?)'
+ $where = 'WHERE `' . $column . '` = ? AND `item_type` = ? AND `share_with` in (?)';
+ $arguments = array($itemSource, $itemType, $groups);
+ $types = array(null, null, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY);
+
+ if ($owner !== null) {
+ $where .= ' AND `uid_owner` = ?';
+ $arguments[] = $owner;
+ $types[] = null;
+ }
+
+ // TODO: inject connection, hopefully one day in the future when this
+ // class isn't static anymore...
+ $conn = \OC_DB::getConnection();
+ $result = $conn->executeQuery(
+ 'SELECT * FROM `*PREFIX*share` ' . $where,
+ $arguments,
+ $types
);
- $result = \OC_DB::executeAudited($query, array($itemSource, $itemType, implode(',', $groups)));
-
- while ($row = $result->fetchRow()) {
+ while ($row = $result->fetch()) {
$shares[] = $row;
}
}