summaryrefslogtreecommitdiffstats
path: root/core/ajax
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-04-10 00:05:11 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-04-10 00:05:11 +0200
commit20eaadd72bfba6b7ff327405a9e6cc66e443a5e9 (patch)
tree334620e7717cb5a3e6a700c49f917063c58922f0 /core/ajax
parentc6151053ba97eb474a4b3f5249e3a0c99ad05d95 (diff)
parent9c19a5dbcc422b361618ca979271bc6218ff33b7 (diff)
downloadnextcloud-server-20eaadd72bfba6b7ff327405a9e6cc66e443a5e9.tar.gz
nextcloud-server-20eaadd72bfba6b7ff327405a9e6cc66e443a5e9.zip
Merge pull request #15182 from rullzer/fix-8231
ajax/share.php should return correct list of suggestions
Diffstat (limited to 'core/ajax')
-rw-r--r--core/ajax/share.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php
index 05756fc1c8b..bc83c41642c 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -255,6 +255,14 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
$usergroups = OC_Group::getUserGroups(OC_User::getUser());
$groups = array_intersect($groups, $usergroups);
}
+
+ $sharedUsers = [];
+ $sharedGroups = [];
+ if (isset($_GET['itemShares'])) {
+ $sharedUsers = isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_USER]) ? $_GET['itemShares'][OCP\Share::SHARE_TYPE_USER] : [];
+ $sharedGroups = isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) ? $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP] : [];
+ }
+
$count = 0;
$users = array();
$limit = 0;
@@ -266,8 +274,13 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
} else {
$users = OC_User::getDisplayNames((string)$_GET['search'], $limit, $offset);
}
+
$offset += $limit;
foreach ($users as $uid => $displayName) {
+ if (in_array($uid, $sharedUsers)) {
+ continue;
+ }
+
if ((!isset($_GET['itemShares'])
|| !is_array((string)$_GET['itemShares'][OCP\Share::SHARE_TYPE_USER])
|| !in_array($uid, (string)$_GET['itemShares'][OCP\Share::SHARE_TYPE_USER]))
@@ -288,6 +301,10 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
$l = \OC::$server->getL10N('core');
foreach ($groups as $group) {
+ if (in_array($group, $sharedGroups)) {
+ continue;
+ }
+
if ($count < 15) {
if (!isset($_GET['itemShares'])
|| !isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])