8000 Keep the description of organization groups when importing a realm by vasipallyn · Pull Request #55176 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Keep the description of organization groups when importing a realm - #55176

Open
vasipallyn wants to merge 2 commits into
keycloak:mainfrom
vasipallyn:55134-org-group-description-import
Open

vasipallyn wants to merge 2 commits into
keycloak:mainfrom
vasipallyn:55134-org-group-description-import

Conversation

@vasipallyn
Copy link
Copy Markdown

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'

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>
@vasipallyn
vasipallyn requested review from a team as code owners November 13, 2026 19:58
Copilot AI balanced review requested due to automatic review settings November 13, 2026 19:58
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 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

@Hakaou Hakaou left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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>
Copilot AI balanced review requested due to automatic review settings November 14, 2026 13:12
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the fix preserving organization-group descriptions during realm import.

No open issues 🎉

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Creating a realm from a representation drops the description of organization groups

3 participants

0