diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-10-17 16:38:11 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-10-17 16:38:11 +0200 |
commit | 6081bfa2bcbe121e373486273ecce58a49e6fa97 (patch) | |
tree | f2504800c66919a53eff9323724b493079569495 /core/ajax | |
parent | c2b4e534534e083147bbad9b564179832cfa2912 (diff) | |
parent | 44287d680bd0e8799724a7595db43c0fafcaff40 (diff) | |
download | nextcloud-server-6081bfa2bcbe121e373486273ecce58a49e6fa97.tar.gz nextcloud-server-6081bfa2bcbe121e373486273ecce58a49e6fa97.zip |
Merge branch 'master' into routing
Conflicts:
lib/search/provider/file.php
settings/ajax/changepassword.php
settings/settings.php
Diffstat (limited to 'core/ajax')
-rw-r--r-- | core/ajax/share.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php index b6f96bfd340..0fa162fb371 100644 --- a/core/ajax/share.php +++ b/core/ajax/share.php @@ -88,6 +88,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 @@ -106,13 +107,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()) { @@ -122,7 +132,6 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo } } $count = 0; - $groups = OC_Group::getUserGroups(OC_User::getUser()); foreach ($groups as $group) { if ($count < 4) { if (stripos($group, $_GET['search']) !== false |