summaryrefslogtreecommitdiffstats
path: root/lib/private/share
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-01-19 14:39:00 +0100
committerJoas Schilling <nickvergessen@gmx.de>2015-01-23 15:11:06 +0100
commit8fa3e7a6bf42fc907a5e98f01104220b35fee48f (patch)
treeedd39ab43325368e27163adafea4da1c249b3f7f /lib/private/share
parent3a66b7c6eca7a7b841ec8c15c59f691d3079afab (diff)
downloadnextcloud-server-8fa3e7a6bf42fc907a5e98f01104220b35fee48f.tar.gz
nextcloud-server-8fa3e7a6bf42fc907a5e98f01104220b35fee48f.zip
Do not retrieve shares through group if user has no group
Diffstat (limited to 'lib/private/share')
-rw-r--r--lib/private/share/share.php42
1 files changed, 22 insertions, 20 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index e5f350a24fb..c9f9654203e 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -337,27 +337,29 @@ class Share extends \OC\Share\Constants {
if(empty($shares) && $user !== null) {
$groups = \OC_Group::getUserGroups($user);
- $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
- );
+ 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);
+
+ if ($owner !== null) {
+ $where .= ' AND `uid_owner` = ?';
+ $arguments[] = $owner;
+ $types[] = null;
+ }
- while ($row = $result->fetch()) {
- $shares[] = $row;
+ // 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->fetch()) {
+ $shares[] = $row;
+ }
}
}