summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-01-23 12:59:39 +0100
committerMorris Jobke <hey@morrisjobke.de>2015-01-23 12:59:39 +0100
commit80560e70b7133739f87cf6a03acb55169fb2462f (patch)
treea7ba5dc6981c79dde9302a6c12700b3b489d5ca6 /lib
parent56c51d481c8370d0171f4ebb073ed757ccb5c07e (diff)
parent18d46dfdeb2facc9f5c5d9f1827b27714acb96dd (diff)
downloadnextcloud-server-80560e70b7133739f87cf6a03acb55169fb2462f.tar.gz
nextcloud-server-80560e70b7133739f87cf6a03acb55169fb2462f.zip
Merge pull request #13470 from owncloud/stable7-share-fixfindshareforuserwithmultiplegroups
[stable7] Fix getItemSharedWithUser for groups
Diffstat (limited to 'lib')
-rw-r--r--lib/private/share/share.php29
1 files changed, 17 insertions, 12 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index b637b87b5eb..be113568a3b 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -287,7 +287,7 @@ class Share extends \OC\Share\Constants {
* Get the item of item type shared with a given user by source
* @param string $itemType
* @param string $itemSource
- * @param string $user User user to whom the item was shared
+ * @param string $user User to whom the item was shared
* @param int $shareType only look for a specific share type
* @return array Return list of items with file_target, permissions and expiration
*/
@@ -332,18 +332,23 @@ 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 (?)'
- );
-
- $result = \OC_DB::executeAudited($query, array($itemSource, $itemType, implode(',', $groups)));
+ if (!empty($groups)) {
+ $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);
+
+ // 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
+ );
- while ($row = $result->fetchRow()) {
- $shares[] = $row;
+ while ($row = $result->fetch()) {
+ $shares[] = $row;
+ }
}
}