diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2012-08-06 20:43:08 -0400 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2012-08-06 20:43:08 -0400 |
commit | b6b713eb765cee05cec434cce2f79749c6c2755f (patch) | |
tree | b72e9eed85cc0963de20745b186af2dbcba503d3 /core/ajax/share.php | |
parent | 7c0a5d4a5933c5c9fa91956452a15d57c505284d (diff) | |
download | nextcloud-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.php | 15 |
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)); |