Repository navigation
Keep the description of organization groups when importing a realm - #55176
vasipallyn wants to merge 2 commits into
Conversation
DefaultExportImportManager.importOrganizationGroup did not c 8000 opy the group description, while RepresentationToModel.importGroup does for realm groups, so organization groups lost their description when a realm was created from an exported representation. Closes keycloak#55134 Signed-off-by: Nagi <vasipallyn@gmail.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the change preserving organization group descriptions during realm import.
No open issues 🎉
What changed in this PR
Fixes #55134 by preserving organization group descriptions during realm import, matching existing realm-group import behavior.
Changes:
- Restores descriptions when the imported representation supplies a non-null value.
- Extends export/import round-trip tests to verify top-level organization group descriptions.
| File | Description |
|---|---|
testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/organization/exportimport/OrganizationExportTest.java |
Adds descriptions to top-level test groups and checks their preservation. |
model/storage-private/src/main/java/org/keycloak/storage/datastore/DefaultExportImportManager.java |
Applies non-null descriptions when importing organization groups. |
Review effort: Balanced
There was a problem hiding this comment.
Thanks @vasipallyn for picking this up. The three tests of OrganizationExportTest pass on 7b6ff5f in my local run. Removing the description assignment makes testExport fail with expected: <Description of Department-0> but was: <null>.
#55135 moves importOrganizationGroup to RepresentationToModel. The current branches conflict in DefaultExportImportManager. I will keep this fix when I rebase #55135 if this PR merges first.
| validateGroupIds(topLevelGroups, expectedGroupIds); | ||
|
|
||
| // Validate descriptions of top-level groups are preserved | ||
| for (GroupRepresentation group : topLevelGroups) { |
There was a problem hiding this comment.
update can set a subgroup's description after addSubGroup. Could the test use that in its setup and check the descriptions of Development-0 and QA-0 after the round trip too?
Set descriptions on the Development and QA subgroups (through update, since addSubGroup does not store the description) and check that they survive the export/import round trip. Signed-off-by: Nagi <vasipallyn@gmail.com>
Closes #55134
'DefaultExportImportManager.importOrganizationGroup' now sets the group description, following 'RepresentationToModel.importGroup' for realm groups. Like the realm-group import, it only sets the description when the representation has one.
'OrganizationExportTest' now gives the top-level organization groups a description and checks it after the export/import round trip. Subgroups are not covered because creating an organization subgroup through 'OrganizationGroupResource.addSubGroup' does not store the description in the first place, unlike 'addTopLevelGroup'. That looks like a separate bug, so I left it out of this PR and mentioned it on the issue.
I could not run the testsuite locally, so I am relying on CI for 'OrganizationExportTest'