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

Limit ldap user count #50171

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Limit ldap user count #50171

wants to merge 6 commits into from

Conversation

come-nc
Copy link
Contributor

@come-nc come-nc commented Jan 14, 2025

  • Resolves: #

Summary

This avoids listing all LDAP users only to check if there are more than 100 for the updatenotification application. This speeds up opening admin settings a lot on big instances with LDAP backend.
The new user count limit is made so that it can be implemented in other backends if needed, and places calling the user count only to compare against a threshold have been adapted to set a limit.

Checklist

@come-nc come-nc added the 3. to review Waiting for reviews label Jan 14, 2025
@come-nc come-nc self-assigned this Jan 14, 2025
@come-nc come-nc added this to the Nextcloud 31 milestone Jan 14, 2025
@skjnldsv skjnldsv mentioned this pull request Jan 14, 2025
@come-nc come-nc requested review from nickvergessen, blizzz, a team, icewind1991, Altahrim and nfebe and removed request for a team January 14, 2025 16:35
@come-nc
Copy link
Contributor Author

come-nc commented Jan 14, 2025

cypress failure is unrelated

Copy link
Member

@blizzz blizzz left a comment

Choose a reason for hiding this comment

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

few remarks


foreach ($this->backends as $backend) {
if ($onlyMappedUsers && $backend instanceof ICountMappedUsersBackend) {
$backendUsers = $backend->countMappedUsers();
Copy link
Member

Choose a reason for hiding this comment

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

less relevant, but it could benefit from a limit as well?

*/
public function countUsers() {
Copy link
Member

Choose a reason for hiding this comment

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

limit is not being used

if ($this->userPluginManager->implementsActions(Backend::COUNT_USERS)) {
return $this->userPluginManager->countUsers();
}

$filter = $this->access->getFilterForUserCount();
$cacheKey = 'countUsers-' . $filter;
$cacheKey = 'countUsers-' . $filter . '-' . $limit;
Copy link
Member

Choose a reason for hiding this comment

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

not necessary, the cache is being flushed after configuration changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants