summaryrefslogtreecommitdiffstats
path: root/core/ajax
diff options
context:
space:
mode:
authorCraig Morrissey <craig@owncloud.com>2014-11-24 16:13:42 -0500
committerThomas Müller <thomas.mueller@tmit.eu>2015-05-15 18:03:18 +0200
commitca341a8d59caa62a72762166378aadb32d60236c (patch)
treeaaa4ebdcb4311c215b5baf83eca89aebb44c262c /core/ajax
parent8e61ad08726659179ff6a208b26772bba41cbe25 (diff)
downloadnextcloud-server-ca341a8d59caa62a72762166378aadb32d60236c.tar.gz
nextcloud-server-ca341a8d59caa62a72762166378aadb32d60236c.zip
add support for limit request parameter to getShareWith
Diffstat (limited to 'core/ajax')
-rw-r--r--core/ajax/share.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php
index a0db77fd1f9..e78d274815d 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -281,8 +281,10 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
$users = array();
$limit = 0;
$offset = 0;
- while ($count < 15 && count($users) == $limit) {
- $limit = 15 - $count;
+ // limit defaults to 15 if not specified via request parameter and can be no larger than 500
+ $request_limit = min((int)$_GET['limit'] ?: 15, 500);
+ while ($count < $request_limit && count($users) == $limit) {
+ $limit = $request_limit - $count;
if ($shareWithinGroupOnly) {
$users = OC_Group::displayNamesInGroups($usergroups, (string)$_GET['search'], $limit, $offset);
} else {
@@ -319,7 +321,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
continue;
}
- if ($count < 15) {
+ if ($count < $request_limit) {
if (!isset($_GET['itemShares'])
|| !isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])
|| !is_array((string)$_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])