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

/ocs/v1.php/cloud/groups UPDATE method - correct status when group not found #39537

Merged
merged 1 commit into from
Jul 27, 2023

Conversation

bigcat88
Copy link
Member

  • Resolves: did not create one

Summary

We should return OCSController::RESPOND_NOT_FOUND when something from input parameters not found and set text description what exactly was not found.

Checklist

Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
@bigcat88 bigcat88 changed the title to return correct code when group not found /ocs/v1.php/cloud/groups UPDATE method - correct status when group not found Jul 22, 2023
@susnux susnux requested review from a team, ArtificialOwl, icewind1991 and Fenn-CS and removed request for a team July 22, 2023 23:29
@susnux susnux added 3. to review Waiting for reviews php Pull requests that update Php code feature: users and groups labels Jul 22, 2023
@@ -271,6 +271,9 @@ public function updateGroup(string $groupId, string $key, string $value): DataRe

if ($key === 'displayname') {
$group = $this->groupManager->get($groupId);
if ($group === null) {
throw new OCSException('Group does not exist', OCSController::RESPOND_NOT_FOUND);
Copy link
Contributor

@Fenn-CS Fenn-CS Jul 22, 2023

Choose a reason for hiding this comment

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

Suggested change
throw new OCSException('Group does not exist', OCSController::RESPOND_NOT_FOUND);
throw new OCSException("Group $groupId does not exist", OCSController::RESPOND_NOT_FOUND);

Is probably more helpful.

Copy link
Member Author

Choose a reason for hiding this comment

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

But the caller already knows what group he requested to edit.

Copy link
Contributor

@Fenn-CS Fenn-CS left a comment

Choose a reason for hiding this comment

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

Otherwise looks good.

@bigcat88 bigcat88 merged commit b93f101 into master Jul 27, 2023
38 checks passed
@bigcat88 bigcat88 deleted the ocs-update-group branch July 27, 2023 17:44
@bigcat88
Copy link
Member Author

/backport to stable27

@bigcat88
Copy link
Member Author

/backport to stable26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews feature: users and groups php Pull requests that update Php code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants