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

Properly throw errors on users management #16746

Closed

Conversation

skjnldsv
Copy link
Member

The list of error codes is a mess btw, should we fix them as well?
What is the proper way of doing this? One error code per error type? Bad email 102, bad quota, 103.. etc?

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
@@ -458,7 +459,7 @@ public function editUser(string $userId, string $key, string $value): DataRespon

$targetUser = $this->userManager->get($userId);
if ($targetUser === null) {
throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED);
throw new OCSException('Unknown user', 101);
Copy link
Member Author

Choose a reason for hiding this comment

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

to be consistent with others methods on this page 🤷‍♂️

Copy link
Member

Choose a reason for hiding this comment

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

But now it reveals to anyone if a user exists, while before it required it to be your own user or you having subadmin/admin permissions

@kesselb
Copy link
Contributor

kesselb commented Aug 15, 2019

The list of error codes is a mess btw

At least its documented ;)

@skjnldsv
Copy link
Member Author

At least its documented ;)

Lol, wrongly! It says 101 - user not found, but it's actually not what is in the code! 😱

@@ -638,7 +639,7 @@ public function deleteUser(string $userId): DataResponse {
$targetUser = $this->userManager->get($userId);

if ($targetUser === null || $targetUser->getUID() === $currentLoggedInUser->getUID()) {
throw new OCSException('', 101);
throw new OCSException('Unknown user', 101);
Copy link
Member

Choose a reason for hiding this comment

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

unknown is not correct for the second part of the if condition

@skjnldsv skjnldsv closed this Oct 4, 2019
@skjnldsv skjnldsv deleted the fix/provisioning_api/users-edit-error-messages branch October 4, 2019 06:48
@skjnldsv skjnldsv restored the fix/provisioning_api/users-edit-error-messages branch October 7, 2019 13:07
@skjnldsv skjnldsv reopened this Oct 7, 2019
This was referenced Dec 11, 2019
@rullzer rullzer modified the milestones: Nextcloud 18, Nextcloud 19 Dec 12, 2019
@rullzer rullzer mentioned this pull request Apr 4, 2020
80 tasks
@skjnldsv skjnldsv added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Apr 9, 2020
This was referenced Apr 9, 2020
@rullzer rullzer mentioned this pull request Apr 23, 2020
11 tasks
@skjnldsv skjnldsv modified the milestones: Nextcloud 19, Nextcloud 20 Apr 27, 2020
@MorrisJobke MorrisJobke mentioned this pull request Aug 11, 2020
57 tasks
@MorrisJobke
Copy link
Member

Nothing for 20 -> move to 21

This was referenced Dec 14, 2020
@skjnldsv skjnldsv closed this Dec 22, 2020
@skjnldsv skjnldsv deleted the fix/provisioning_api/users-edit-error-messages branch December 22, 2020 07:38
Sign up for free to 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.

None yet

6 participants