summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/DAV
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2020-12-11 14:04:40 +0100
committerArthur Schiwon <blizzz@arthur-schiwon.de>2020-12-15 11:53:39 +0100
commit2b017b704a4a49801bc09774a1a17cfedca9cc7e (patch)
treefe97cec90a860aee749340c91d3bb373d061fadf /apps/dav/lib/DAV
parent8506d0864b3a017baeed2ad5f9a032ae1d7a6734 (diff)
downloadnextcloud-server-2b017b704a4a49801bc09774a1a17cfedca9cc7e.tar.gz
nextcloud-server-2b017b704a4a49801bc09774a1a17cfedca9cc7e.zip
dav search to honour sharing.maxAutocompleteResults setting
- it is being used on frontend by users - user and big instances benefit from quicker results and less load Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/dav/lib/DAV')
-rw-r--r--apps/dav/lib/DAV/GroupPrincipalBackend.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/apps/dav/lib/DAV/GroupPrincipalBackend.php b/apps/dav/lib/DAV/GroupPrincipalBackend.php
index 38944317424..747976b6ad3 100644
--- a/apps/dav/lib/DAV/GroupPrincipalBackend.php
+++ b/apps/dav/lib/DAV/GroupPrincipalBackend.php
@@ -27,6 +27,7 @@
namespace OCA\DAV\DAV;
+use OCP\IConfig;
use OCP\IGroup;
use OCP\IGroupManager;
use OCP\IUser;
@@ -47,18 +48,24 @@ class GroupPrincipalBackend implements BackendInterface {
/** @var IShareManager */
private $shareManager;
+ /** @var IConfig */
+ private $config;
/**
* @param IGroupManager $IGroupManager
* @param IUserSession $userSession
* @param IShareManager $shareManager
*/
- public function __construct(IGroupManager $IGroupManager,
- IUserSession $userSession,
- IShareManager $shareManager) {
+ public function __construct(
+ IGroupManager $IGroupManager,
+ IUserSession $userSession,
+ IShareManager $shareManager,
+ IConfig $config
+ ) {
$this->groupManager = $IGroupManager;
$this->userSession = $userSession;
$this->shareManager = $shareManager;
+ $this->config = $config;
}
/**
@@ -205,10 +212,11 @@ class GroupPrincipalBackend implements BackendInterface {
$restrictGroups = $this->groupManager->getUserGroupIds($user);
}
+ $searchLimit = $this->config->getSystemValue('sharing.maxAutocompleteResults', null);
foreach ($searchProperties as $prop => $value) {
switch ($prop) {
case '{DAV:}displayname':
- $groups = $this->groupManager->search($value);
+ $groups = $this->groupManager->search($value, $searchLimit);
$results[] = array_reduce($groups, function (array $carry, IGroup $group) use ($restrictGroups) {
$gid = $group->getGID();