Properly throw errors on users management#16746
Closed
Conversation
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
skjnldsv
commented
Aug 15, 2019
| $targetUser = $this->userManager->get($userId); | ||
| if ($targetUser === null) { | ||
| throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED); | ||
| throw new OCSException('Unknown user', 101); |
Member
Author
There was a problem hiding this comment.
to be consistent with others methods on this page 🤷♂️
Member
There was a problem hiding this comment.
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
Contributor
At least its documented ;) |
Member
Author
Lol, wrongly! It says |
blizzz
approved these changes
Aug 16, 2019
|
|
||
| if ($targetUser === null || $targetUser->getUID() === $currentLoggedInUser->getUID()) { | ||
| throw new OCSException('', 101); | ||
| throw new OCSException('Unknown user', 101); |
Member
There was a problem hiding this comment.
unknown is not correct for the second part of the if condition
This was referenced Apr 9, 2020
Merged
Merged
Merged
Member
|
Nothing for 20 -> move to 21 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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?