Skip to content

Add endpoint for getting disabled user list - #39756

Merged
come-nc merged 5 commits into
masterfrom
enh/add-disabled-users-endpoint
Oct 10, 2023
Merged

Add endpoint for getting disabled user list#39756
come-nc merged 5 commits into
masterfrom
enh/add-disabled-users-endpoint

Conversation

@come-nc

@come-nccome-nc commented Aug 8, 2023

Copy link
Copy Markdown
Contributor
  • Resolves: #

Summary

Adds an endpoint to get the list of disabled users, with offset and limit.
This avoids fetching all the users when opening the disabled user list, fixing the disabled user list for LDAP backed installations which do not have a lot of disabled users. Also avoids spamming the LDAP server when opening disabled user list.

TODO

Checklist

@come-nccome-nc added the 2. developing Work in progress label Aug 8, 2023
@come-nccome-nc added this to the Nextcloud 28 milestone Aug 8, 2023
@come-nccome-nc self-assigned this Aug 8, 2023
Comment threadapps/provisioning_api/lib/Controller/UsersController.php Fixed
Comment threadapps/provisioning_api/lib/Controller/UsersController.php Fixed
Comment threadlib/private/User/Manager.php Fixed
Comment threadlib/private/User/Manager.php Fixed
Comment threadlib/private/User/Manager.php Fixed
Comment threadapps/provisioning_api/lib/Controller/UsersController.php Fixed
Comment threadapps/provisioning_api/lib/Controller/UsersController.php Fixed
Comment threadapps/provisioning_api/lib/Controller/UsersController.php Outdated
@provokateurin

Copy link
Copy Markdown
Member

There is a new CI workflow that checks that the OpenAPI specs are up-to-date. Please rebase onto master and regenerate the specs so that the workflow can do it's job.

@come-nc
come-ncforce-pushed the enh/add-disabled-users-endpoint branch 2 times, most recently from 0833802 to fa1f37cCompareAugust 28, 2023 13:52

@provokateurinprovokateurin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

API LGTM

@Pytal
Pytalforce-pushed the enh/add-disabled-users-endpoint branch from 303c153 to 4d63760CompareSeptember 9, 2023 00:13
@come-nc
come-ncforce-pushed the enh/add-disabled-users-endpoint branch 2 times, most recently from bc0fcbe to 93722e7CompareSeptember 18, 2023 13:33
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
@come-nc
come-ncforce-pushed the enh/add-disabled-users-endpoint branch from 93722e7 to 61da2b9CompareOctober 9, 2023 10:04
@come-nccome-nc added enhancement 3. to review Waiting for reviews feature: users and groups and removed 2. developing Work in progress labels Oct 9, 2023
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
@come-nc
come-nc requested review from a team, Altahrim, icewind1991, nfebe and sorbaugh and removed request for a teamOctober 9, 2023 12:52

@nfebenfebe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A default value for limit seems reasonable of if null, we should check for valid values different from zero... Such as negative numbers and 0

if ($limit !== null && $limit < 0) {
// Whatever exceptionthrownewInvalidArgumentException("Invalid limit value: $limit");
}
if ($offset < 0) {
thrownewInvalidArgumentException("Invalid offset value: $offset");
}

Generally, this is a little slim or error handling.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
@come-nc

Copy link
Copy Markdown
ContributorAuthor

A default value for limit seems reasonable of if null, we should check for valid values different from zero... Such as negative numbers and 0

 if ($limit !== null && $limit < 0) {
// Whatever exception
throw new InvalidArgumentException("Invalid limit value: $limit");
}
if ($offset < 0) {
throw new InvalidArgumentException("Invalid offset value: $offset");
}

Generally, this is a little slim or error handling.

Nice input, I’ve added that to the controller method.
For the internal method I consider the caller knows what he’s doing, but for the controller it makes sense to block invalid values.

@come-nc
come-nc enabled auto-merge October 10, 2023 09:04
@come-nc
come-nc disabled auto-merge October 10, 2023 11:33
@come-nc
come-nc merged commit 43971f6 into masterOct 10, 2023
@come-nc
come-nc deleted the enh/add-disabled-users-endpoint branch October 10, 2023 11:33
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@come-nc@provokateurin@Altahrim@nfebe@github-advanced-security