Skip to content

Properly throw errors on users management - #16746

Closed
skjnldsv wants to merge 1 commit into
masterfrom
fix/provisioning_api/users-edit-error-messages
Closed

Properly throw errors on users management#16746
skjnldsv wants to merge 1 commit into
masterfrom
fix/provisioning_api/users-edit-error-messages

Conversation

@skjnldsv

Copy link
Copy Markdown
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>
$targetUser = $this->userManager->get($userId);
if ($targetUser === null) {
throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED);
throw new OCSException('Unknown user', 101);

Copy link
Copy Markdown
MemberAuthor

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
Copy Markdown
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
Copy Markdown
Contributor

The list of error codes is a mess btw

At least its documented ;)

@skjnldsv

Copy link
Copy Markdown
MemberAuthor

At least its documented ;)

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


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

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.

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

@skjnldsvskjnldsv 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
@skjnldsvskjnldsv reopened this Oct 7, 2019
This was referenced Dec 11, 2019
@rullzerrullzer mentioned this pull request Apr 4, 2020
80 tasks
@skjnldsvskjnldsv added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Apr 9, 2020
This was referenced Apr 9, 2020
@rullzerrullzer mentioned this pull request Apr 23, 2020
11 tasks
@MorrisJobkeMorrisJobke mentioned this pull request Aug 11, 2020
57 tasks
@MorrisJobke

Copy link
Copy Markdown
Member

Nothing for 20 -> move to 21

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

6 participants

@skjnldsv@kesselb@MorrisJobke@nickvergessen@blizzz@rullzer