Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dav principal search to honour sharing.maxAutocompleteResults setting #24659

Merged
merged 3 commits into from
Dec 16, 2020

Conversation

blizzz
Copy link
Member

@blizzz blizzz commented Dec 11, 2020

This crossed me when investigating a different issue. When using the calendar app to share the calendar, the DAV search is being used. There is not limit, and if I remember correctly the DAV protocol does not foresee to submit a value (correct me if i am wrong). When typing 'pow' in the search field, first I thought I ended up in an infinite loop (for some other changes i did). But in fact, it just searches the LDAP until the very end, resulting in 438 users in the results.

The limitation speeds up finding users and groups, increasing response time for end users and decreasing load on the servers.

Question: for now I left the default behaviour as unlimited, but would prefer to limit it to 25 as it is done in most other places. Objections? And, are there any fundamental objects to this change?

@blizzz blizzz added this to the Nextcloud 21 milestone Dec 11, 2020
@blizzz blizzz changed the title dav search to honour sharing.maxAutocompleteResults setting dav principal search to honour sharing.maxAutocompleteResults setting Dec 11, 2020
@@ -72,7 +72,7 @@ public function __construct() {
$proxyMapper,
\OC::$server->getConfig()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\OC::$server->getConfig()
$config

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the userSession further up. And then using get over the deprecated getters. And then DI, at least the container. I agree, but that's better kept in a separate PR. I am afraid of an endless rat-tail here.

@@ -205,10 +212,11 @@ public function searchPrincipals($prefixPath, array $searchProperties, $test = '
$restrictGroups = $this->groupManager->getUserGroupIds($user);
}

$searchLimit = $this->config->getSystemValue('sharing.maxAutocompleteResults', null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cast to int|null, just to be sure?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, there's gold:

interface:

Screenshot_20201211_234750

local:

Screenshot_20201211_235042

I set 25 as default and went with int and a sanitization, put it into a constants, streamlined other differing default values, updated the config.sample.php.

@blizzz blizzz force-pushed the enh/noid/dav-honour-sharing.maxAutocompleteResults branch from c8a933e to 8e9b308 Compare December 11, 2020 23:33
@rullzer rullzer mentioned this pull request Dec 14, 2020
59 tasks
@blizzz
Copy link
Member Author

blizzz commented Dec 14, 2020

/compile /apps/files_sharing/

@blizzz blizzz added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Dec 14, 2020
- 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>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
@blizzz blizzz force-pushed the enh/noid/dav-honour-sharing.maxAutocompleteResults branch from fc1c05e to d8ad4ef Compare December 15, 2020 10:53
@blizzz
Copy link
Member Author

blizzz commented Dec 15, 2020

/compile /apps/files_sharing/

Signed-off-by: npmbuildbot-nextcloud[bot] <npmbuildbot-nextcloud[bot]@users.noreply.github.com>
@rullzer rullzer merged commit 1d4c896 into master Dec 16, 2020
@rullzer rullzer deleted the enh/noid/dav-honour-sharing.maxAutocompleteResults branch December 16, 2020 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish enhancement feature: dav
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants