summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-10-09 08:35:07 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-10-09 08:35:07 -0400
commitb475164e95e26c23e6710e0ca5153b752014aa59 (patch)
tree3e2135b28a4403b3e94d92df8638ab97e19eb65c /core
parentf29f1cad1d0a868235737b74f15f97e053fc34a7 (diff)
downloadnextcloud-server-b475164e95e26c23e6710e0ca5153b752014aa59.tar.gz
nextcloud-server-b475164e95e26c23e6710e0ca5153b752014aa59.zip
Fix autocomplete search for users for groups only share policy
Diffstat (limited to 'core')
-rw-r--r--core/ajax/share.php17
1 files changed, 11 insertions, 6 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php
index 8309a062119..84e84be5acb 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -89,6 +89,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
break;
case 'getShareWith':
if (isset($_GET['search'])) {
+ $sharePolicy = OC_Appconfig::getValue('core', 'shareapi_share_policy', 'global');
$shareWith = array();
// if (OC_App::isEnabled('contacts')) {
// // TODO Add function to contacts to only get the 'fullname' column to improve performance
@@ -107,13 +108,22 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
// }
// }
// }
+ if ($sharePolicy == 'groups_only') {
+ $groups = OC_Group::getUserGroups(OC_User::getUser());
+ } else {
+ $groups = OC_Group::getGroups();
+ }
$count = 0;
$users = array();
$limit = 0;
$offset = 0;
while ($count < 4 && count($users) == $limit) {
$limit = 4 - $count;
- $users = OC_User::getUsers($_GET['search'], $limit, $offset);
+ if ($sharePolicy == 'groups_only') {
+ $users = OC_Group::usersInGroups($groups, $_GET['search'], $limit, $offset);
+ } else {
+ $users = OC_User::getUsers($_GET['search'], $limit, $offset);
+ }
$offset += $limit;
foreach ($users as $user) {
if ((!isset($_GET['itemShares']) || !is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_USER]) || !in_array($user, $_GET['itemShares'][OCP\Share::SHARE_TYPE_USER])) && $user != OC_User::getUser()) {
@@ -123,11 +133,6 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
}
}
$count = 0;
- if (\OC_Appconfig::getValue('core', 'shareapi_share_policy', 'global') == 'groups_only') {
- $groups = OC_Group::getUserGroups(OC_User::getUser());
- } else {
- $groups = OC_Group::getGroups();
- }
foreach ($groups as $group) {
if ($count < 4) {
if (stripos($group, $_GET['search']) !== false