Map GroupNotFoundException to 404 in setUserGroups and document groups semantics#476
Merged
Merged
Conversation
…s semantics Under the new boolean-map membership model, group lifecycle is managed via the top-level groups map, so a non-existent group referenced from UserModel.groups is a client error (404), not an internal server error (500). Translate the Atlassian GroupNotFoundException thrown by addUserToGroup/removeUserFromGroup into the project's GroupNotFoundException. Add a @Schema description to UserModel.groups so the auto-generated REST API docs explain the true/false/null semantics and the requirement that referenced groups must already exist.
|
There was a problem hiding this comment.
Pull request overview
This PR aligns user group membership behavior with the new boolean-map membership model by translating Atlassian Crowd GroupNotFoundException into the project’s GroupNotFoundException (404) during setUserGroups, and clarifies the groups true/false/null semantics in generated API documentation.
Changes:
- Map missing referenced groups in
setUserGroupstocom.deftdevs.bootstrapi.commons.exception.GroupNotFoundException(HTTP 404) instead of treating them as 500s. - Add coverage ensuring unknown group membership updates fail with the expected NotFound exception.
- Document
UserModel.groupsmembership semantics in OpenAPI schema and generated model docs (Crowd/Jira/Confluence).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
crowd/src/main/java/com/deftdevs/bootstrapi/crowd/service/UsersServiceImpl.java |
Translates Atlassian GroupNotFoundException to the project NotFound exception during group membership updates. |
crowd/src/test/java/com/deftdevs/bootstrapi/crowd/service/UsersServiceTest.java |
Adds a unit test asserting unknown groups produce the project GroupNotFoundException. |
commons/src/main/java/com/deftdevs/bootstrapi/commons/model/UserModel.java |
Adds @Schema description documenting groups true/false/null semantics and pre-existing group requirement. |
crowd/Models/UserModel.md |
Updates generated model docs to describe groups semantics. |
jira/Models/UserModel.md |
Updates generated model docs to describe groups semantics. |
confluence/Models/UserModel.md |
Updates generated model docs to describe groups semantics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.



Under the new boolean-map membership model, group lifecycle is managed via the top-level groups map, so a non-existent group referenced from UserModel.groups is a client error (404), not an internal server error (500). Translate the Atlassian GroupNotFoundException thrown by addUserToGroup/removeUserFromGroup into the project's GroupNotFoundException.
Add a @Schema description to UserModel.groups so the auto-generated REST API docs explain the true/false/null semantics and the requirement that referenced groups must already exist.