-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
ignore non existing users when retrieving details of group members #13644
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
ignore non existing users when retrieving details of group members #13644
Conversation
Signed-off-by: Arthur Schiwon <[email protected]>
| $usersDetails[$userId] = ['id' => $userId]; | ||
| } | ||
| } catch(OCSNotFoundException $e) { | ||
| // continue if a users ceased to exist. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe at least log something?
What's the use case of having a list of users where the user does not exists here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The user is not added to the list when this Exception pops up. Or do you mean something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, I don't really like having blank catches :p
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not an error condition, but a valid scenario.
| # cf. https://github.com/nextcloud/server/issues/12991 | ||
| $data['storageLocation'] = $targetUserObject->getHome(); | ||
| } catch (NoUserException $e) { | ||
| throw new OCSNotFoundException($e->getMessage(), $e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why throw the OCS not found exception? This is mainly osmething to throw when the middleware will handle it. The NoUserException seems perfectly valid here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because it is also done in line 95 (https://github.com/nextcloud/server/pull/13644/files/4915d64de8d0ee862f0fdc92fe9bf856f3e8cbe1#diff-4d20146890eb1004590c5327656f93bdR95), so it is consistent and catches both cases.
|
so, dear reviewers, is it OK to go in? |
skjnldsv
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then good for me :)
MorrisJobke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code makes sense 👍
|
@blizzz Backport to which branches? |
|
/backport to stable15 |
|
/backport to stable14 |
|
Background: the report was against 14.0.4 |
|
The backport to stable14 failed. Please do this backport manually. |
|
backport to stable15 in #13792 |
|
@blizzz backport to 14 failed. Could you do that manually? |
|
yes, this was expected. doing it now. |
Fixes an exception leading to a 404 return of the user details request on the members of a specified group. Please read #12991 (comment) for detailed reasonings.
To reproduce
curl -H "OCS-APIRequest: true" "http://admin:[email protected]/ocs/v2.php/cloud/groups/group1/users/details"Before:
After: