Skip to content

fix(user): count users up to the limit across several backends - #67761

Open
Tiranex wants to merge 1 commit into
nextcloud:masterfrom
Tiranex:fix/count-users-total-limit
Open

Tiranex wants to merge 1 commit into
nextcloud:masterfrom
Tiranex:fix/count-users-total-limit

Conversation

@Tiranex

@Tiranex Tiranex commented Dec 6, 2026

Copy link
Copy Markdown

Summary

With a limit and more than one user backend, Manager::countUsersTotal() and User_Proxy::countUsers() (several LDAP configurations) reduced the remaining limit by the running total instead of by the users of the current backend. The count stopped early and came out too low: backends with 30, 30 and 50 users and countUsersTotal(100) returned 70.

The remaining limit is now reduced by each backend's own count, so the same case returns 100. This matters for checks such as countUsersTotal(100) < 100 (web updater recommendation) and countUsersTotal(100) >= 100 in the DAV migration.

New unit tests in ManagerTest and User_ProxyTest cover a limit spread over three backends, stopping once the limit is reached, and (for LDAP) no limit. Without the fix they fail with 70 instead of 100. The tests/lib/User/ suite and the LDAP User_ProxyTest/User_LDAPTest pass, and php-cs-fixer reports no changes. Not validated on a live instance with several user backends.

TODO

  • Nothing left

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI (Claude Code, claude-opus-5-5). I reviewed the change and ran the tests.

With a limit and several user backends, the remaining limit was reduced by the running total instead of by the users of the current backend, so the count stopped early and came out too low. This affects checks such as countUsersTotal(100) < 100 for recommending the web updater.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Alex <alexperezcoria@gmail.com>
@Tiranex
Tiranex requested review from a team as code owners December 6, 2026 13:18
@Tiranex
Tiranex requested review from Altahrim and come-nc and removed request for a team December 6, 2026 13:18

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

countUsersTotal()/User_Proxy::countUsers() with a limit undercount with several user backends

1 participant