Support key-only (null model) entries in nested map structures for groups and users#473
Merged
Conversation
50ea69a to
7f9888e
Compare
There was a problem hiding this comment.
Pull request overview
Adds support for passing null model entries to setGroup/setUser when processing nested map structures (e.g., YAML), treating them as “key-only” references: return the existing entity if found, otherwise create a minimal entity based on the key.
Changes:
- Update
UsersServiceImpl#setUser(directoryId, username, userModel)to acceptnullmodels (return existing user model; attempt minimal creation if missing). - Update
GroupsServiceImpl#setGroup(directoryId, groupName, groupModel)to acceptnullmodels (return existing group model; create group with key name if missing). - Add unit tests covering the new
null-model behavior for users and groups.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
crowd/src/main/java/com/deftdevs/bootstrapi/crowd/service/UsersServiceImpl.java |
Adds null-model handling in setUser to treat map keys as the identifier and return-or-create accordingly. |
crowd/src/main/java/com/deftdevs/bootstrapi/crowd/service/GroupsServiceImpl.java |
Adds null-model handling in setGroup to return existing groups or create using the key as the name. |
crowd/src/test/java/com/deftdevs/bootstrapi/crowd/service/UsersServiceTest.java |
Adds tests for setUser(..., null) for existing and missing users. |
crowd/src/test/java/com/deftdevs/bootstrapi/crowd/service/GroupsServiceTest.java |
Adds tests for setGroup(..., null) for existing and missing groups. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…oups and users setGroup and setUser now accept a null model value. If the entity already exists it is returned as-is without any updates. If it does not exist, a 404 is returned, since the key-only form is meant to reference an existing entity, not create one.
7f9888e to
e1ebe5a
Compare
|
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.



setGroup and setUser now accept a null model value. If the entity already exists it is returned as-is without any updates. If it does not exist, a 404 is returned, since the key-only form is meant to reference an existing entity, not create one.