summaryrefslogtreecommitdiffstats
path: root/core/ajax/share.php
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-08-06 20:43:08 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-08-06 20:43:08 -0400
commitb6b713eb765cee05cec434cce2f79749c6c2755f (patch)
treeb72e9eed85cc0963de20745b186af2dbcba503d3 /core/ajax/share.php
parent7c0a5d4a5933c5c9fa91956452a15d57c505284d (diff)
downloadnextcloud-server-b6b713eb765cee05cec434cce2f79749c6c2755f.tar.gz
nextcloud-server-b6b713eb765cee05cec434cce2f79749c6c2755f.zip
Only show the user's groups in the share with autocomplete
Diffstat (limited to 'core/ajax/share.php')
-rw-r--r--core/ajax/share.php15
1 files changed, 6 insertions, 9 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php
index f7a41aa3a4a..2cfbb5f3208 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -100,18 +100,15 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['item']
}
}
$count = 0;
- $groups = array();
- $limit = 0;
- $offset = 0;
- while ($count < 4 && count($groups) == $limit) {
- $limit = 4 - $count;
- $groups = OC_Group::getGroups($_GET['search'], $limit, $offset);
- $offset += $limit;
- foreach ($groups as $group) {
- if (!isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) || !in_array($group, $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])) {
+ $groups = OC_Group::getUserGroups(OC_User::getUser());
+ foreach ($groups as $group) {
+ if ($count < 4) {
+ if (stripos($group, $_GET['search']) !== false && (!isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) || !in_array($group, $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]))) {
$shareWith[] = array('label' => $group.' (group)', 'value' => array('shareType' => OCP\Share::SHARE_TYPE_GROUP, 'shareWith' => $group));
$count++;
}
+ } else {
+ break;
}
}
OC_JSON::success(array('data' => $shareWith));