aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/share
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-09-25 13:45:23 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2014-09-25 14:26:31 +0200
commit52b6469b0c2a21ce6e77f8c56dae464eac99781e (patch)
tree66c173983a966fbeb591945ded172ae688f4e666 /lib/private/share
parent968152113e35b39bd18d1ad583dd86d11949e83c (diff)
downloadnextcloud-server-52b6469b0c2a21ce6e77f8c56dae464eac99781e.tar.gz
nextcloud-server-52b6469b0c2a21ce6e77f8c56dae464eac99781e.zip
call \OCP\Share::getItemsSharedWithUser() to get exclude list, this way all checks are executed, e.g. to check if the share is really visible
Diffstat (limited to 'lib/private/share')
-rw-r--r--lib/private/share/helper.php34
1 files changed, 5 insertions, 29 deletions
diff --git a/lib/private/share/helper.php b/lib/private/share/helper.php
index 0c679b2bda4..7e1cbb273b8 100644
--- a/lib/private/share/helper.php
+++ b/lib/private/share/helper.php
@@ -58,37 +58,13 @@ class Helper extends \OC\Share\Constants {
$userAndGroups = false;
}
$exclude = array();
- // Find similar targets to improve backend's chances to generate a unqiue target
- if ($userAndGroups) {
- if ($column == 'file_target') {
- $checkTargets = \OC_DB::prepare('SELECT `' . $column . '` FROM `*PREFIX*share`'
- . ' WHERE `item_type` IN (\'file\', \'folder\')'
- . ' AND `share_type` IN (?,?,?)'
- . ' AND `share_with` IN (\'' . implode('\',\'', $userAndGroups) . '\')');
- $result = $checkTargets->execute(array(self::SHARE_TYPE_USER, self::SHARE_TYPE_GROUP,
- self::$shareTypeGroupUserUnique));
- } else {
- $checkTargets = \OC_DB::prepare('SELECT `' . $column . '` FROM `*PREFIX*share`'
- . ' WHERE `item_type` = ? AND `share_type` IN (?,?,?)'
- . ' AND `share_with` IN (\'' . implode('\',\'', $userAndGroups) . '\')');
- $result = $checkTargets->execute(array($itemType, self::SHARE_TYPE_USER,
- self::SHARE_TYPE_GROUP, self::$shareTypeGroupUserUnique));
- }
- } else {
- if ($column == 'file_target') {
- $checkTargets = \OC_DB::prepare('SELECT `' . $column . '` FROM `*PREFIX*share`'
- . ' WHERE `item_type` IN (\'file\', \'folder\')'
- . ' AND `share_type` = ? AND `share_with` = ?');
- $result = $checkTargets->execute(array(self::SHARE_TYPE_GROUP, $shareWith));
- } else {
- $checkTargets = \OC_DB::prepare('SELECT `' . $column . '` FROM `*PREFIX*share`'
- . ' WHERE `item_type` = ? AND `share_type` = ? AND `share_with` = ?');
- $result = $checkTargets->execute(array($itemType, self::SHARE_TYPE_GROUP, $shareWith));
+
+ $result = \OCP\Share::getItemsSharedWithUser($itemType, $shareWith);
+ foreach ($result as $row) {
+ if ($row['permissions'] > 0) {
+ $exclude[] = $row[$column];
}
}
- while ($row = $result->fetchRow()) {
- $exclude[] = $row[$column];
- }
// Check if suggested target exists first
if (!isset($suggestedTarget)) {