Skip to content

Support key-only (null model) entries in nested map structures for groups and users#473

Merged
pathob merged 1 commit into
mainfrom
fix/null-model-support
May 12, 2026
Merged

Support key-only (null model) entries in nested map structures for groups and users#473
pathob merged 1 commit into
mainfrom
fix/null-model-support

Conversation

@pathob
Copy link
Copy Markdown
Contributor

@pathob pathob commented May 12, 2026

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.

@pathob pathob requested a review from Copilot May 12, 2026 08:14
@pathob pathob force-pushed the fix/null-model-support branch from 50ea69a to 7f9888e Compare May 12, 2026 08:15
@pathob pathob marked this pull request as ready for review May 12, 2026 08:16
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 accept null models (return existing user model; attempt minimal creation if missing).
  • Update GroupsServiceImpl#setGroup(directoryId, groupName, groupModel) to accept null models (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.

Comment thread crowd/src/main/java/com/deftdevs/bootstrapi/crowd/service/UsersServiceImpl.java Outdated
Comment thread crowd/src/test/java/com/deftdevs/bootstrapi/crowd/service/UsersServiceTest.java Outdated
…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.
@pathob pathob force-pushed the fix/null-model-support branch from 7f9888e to e1ebe5a Compare May 12, 2026 08:31
@pathob pathob requested a review from Copilot May 12, 2026 08:33
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

@pathob pathob merged commit 3c7b0d0 into main May 12, 2026
13 checks passed
@pathob pathob deleted the fix/null-model-support branch May 12, 2026 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants