summaryrefslogtreecommitdiffstats
path: root/core/ajax
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2013-08-21 13:15:31 +0200
committerArthur Schiwon <blizzz@owncloud.com>2013-08-30 12:37:46 +0200
commit22e1f73d5e46f4c3d32e250ce9eb3c112875706e (patch)
tree98f071ddec8ffffa11ec5eac6c95e2e1b02dba48 /core/ajax
parentab1f78eac39396113b379360c1fba505923ce999 (diff)
downloadnextcloud-server-22e1f73d5e46f4c3d32e250ce9eb3c112875706e.tar.gz
nextcloud-server-22e1f73d5e46f4c3d32e250ce9eb3c112875706e.zip
Use Group methods for searching, fixes #4201
Diffstat (limited to 'core/ajax')
-rw-r--r--core/ajax/share.php11
1 files changed, 5 insertions, 6 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php
index d3c6a8456a6..648f0a71bd4 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -181,10 +181,10 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
// }
// }
// }
+ $groups = OC_Group::getGroups($_GET['search']);
if ($sharePolicy == 'groups_only') {
- $groups = OC_Group::getUserGroups(OC_User::getUser());
- } else {
- $groups = OC_Group::getGroups();
+ $usergroups = OC_Group::getUserGroups(OC_User::getUser());
+ $groups = array_intersect($groups, $usergroups);
}
$count = 0;
$users = array();
@@ -219,11 +219,10 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
foreach ($groups as $group) {
if ($count < 15) {
- if (stripos($group, $_GET['search']) !== false
- && (!isset($_GET['itemShares'])
+ if (!isset($_GET['itemShares'])
|| !isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])
|| !is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])
- || !in_array($group, $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]))) {
+ || !in_array($group, $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])) {
$shareWith[] = array(
'label' => $group.' ('.$l->t('group').')',
'value' => array(