summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2013-08-21 13:15:31 +0200
committerArthur Schiwon <blizzz@owncloud.com>2013-08-21 13:15:31 +0200
commitbf933c77a1b96b4698c777ea924562366e8bb92c (patch)
tree15f778ed1199361467a4b28687fac62159a3a2d4 /core
parent76e4fe79d2d4529223d4c6c00f4196d41e9b2e4c (diff)
downloadnextcloud-server-bf933c77a1b96b4698c777ea924562366e8bb92c.tar.gz
nextcloud-server-bf933c77a1b96b4698c777ea924562366e8bb92c.zip
Use Group methods for searching, fixes #4201
Diffstat (limited to 'core')
-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 5854b65aa03..3abe2168cd0 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -176,10 +176,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();
@@ -210,11 +210,10 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
$count = 0;
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.' (group)',
'value' => array(