Repository navigation
Conversation
Closes keycloak#55123 Signed-off-by: Shubham <87247136+shuseng8@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the change to include the new group’s ID in organization group creation events.
No open issues 🎉
What changed in this PR
Fixes #55123 by including the new group’s ID in top-level organization group creation events, allowing those events to appear in the group’s Admin events tab.
Changes:
- Records the group-specific path for
CREATEevents while preserving the collection path forUPDATEevents. - Adds regression tests for both event paths and the creation event’s representation.
- Documents the change and clarifies that historical events remain unchanged.
| File | Description |
|---|---|
| tests/base/src/test/java/org/keycloak/tests/organization/group/OrganizationGroupsTest.java | Tests creation and move-to-top-level admin events. |
| services/src/main/java/org/keycloak/organization/admin/resource/OrganizationGroupsResource.java | Includes the new group ID in the creation event path. |
| docs/documentation/upgrading/topics/changes/changes-27_0_0.adoc | Explains the new event path and implications for existing filters. |
Review effort: Balanced
There was a problem hiding this comment.
LGTM. Read only, didn't run it.
Compared it with GroupsResource#addTopLevelGroup on main: the realm version sets resourcePath(uri) on the move branch and resourcePath(uri, child.getId()) on the create branch, then calls representation(rep).success() once after. This PR gives OrganizationGroupsResource exactly that shape, and rep.setId(group.getId()) was already there before the event, so the representation in the CREATE event carries the ID the new test asserts.
Written with help from an AI assistant (Claude Code); each reference was checked against the source.
Closes #55123
The admin event recorded when a top-level organization group is created now has the resource path
organizations/<orgId>/groups/<groupId>instead oforganizations/<orgId>/groups. This matches realm groups, whereGroupsResourcerecords the create event asgroups/<groupId>. With the ID in the path, the event can be found under the group's own path, for example in its "Admin events" tab.Changes:
OrganizationGroupsResource#addTopLevelGroupusesresourcePath(uri, group.getId())forCREATE. Moving an existing group to the top level (UPDATE) still records the request path, like realm groups do.OrganizationGroupsTestassert theCREATEevent (operation, resource type, path with the group ID, and representation with the ID and name) and the unchanged path of the move-to-top-levelUPDATEevent. TheCREATEtest fails without the fix.changes-27_0_0.adoc. As described in the issue, events recorded before the upgrade are not migrated.Not changed: creating a subgroup through
OrganizationGroupResource#addSubGroupstill recordsorganizations/<orgId>/groups/<parentId>/children. This is the same as realm subgroups (groups/<parentId>/childreninGroupResource#addChild), so I kept this PR limited to the case in the issue. Happy to change both in a follow-up if you'd like.Tests run locally (embedded server):
org.keycloak.tests.organization.group.*Test: 83 tests, all passedorg.keycloak.tests.organization.**,AdminEventTestandorg.keycloak.tests.admin.group.*Test: 560 tests, all passed./mvnw -Pspotless spotless:checkpassed onservicesandtests/baseAI assistance: An AI agent was used to help implement this change. I reviewed the code and tests and take responsibility for the contribution.