From 8bb35981296034dc3812b973d32e3bd4cad0bc1a Mon Sep 17 00:00:00 2001 From: Jon Koops Date: Wed, 18 Sep 2024 09:33:54 +0200 Subject: [PATCH] Remove deprecated `setOrCreateChild()` method from Admin Client (#33022) Closes #33021 Signed-off-by: Jon Koops --- .../upgrading/topics/changes/changes-26_0_0.adoc | 4 ++++ .../src/resources/groups.ts | 16 ---------------- .../keycloak-admin-client/test/groups.spec.ts | 16 ---------------- 3 files changed, 4 insertions(+), 32 deletions(-) diff --git a/docs/documentation/upgrading/topics/changes/changes-26_0_0.adoc b/docs/documentation/upgrading/topics/changes/changes-26_0_0.adoc index a115a2a5d7..46cf684a3a 100644 --- a/docs/documentation/upgrading/topics/changes/changes-26_0_0.adoc +++ b/docs/documentation/upgrading/topics/changes/changes-26_0_0.adoc @@ -276,3 +276,7 @@ There are now generalized events for updating (`UPDATE_CREDENTIAL`) and removing The new event types are supported by the Email Event Listener. The following event types are now deprecated and will be removed in a future version: `UPDATE_PASSWORD`, `UPDATE_PASSWORD_ERROR`, `UPDATE_TOTP`, `UPDATE_TOTP_ERROR`, `REMOVE_TOTP`, `REMOVE_TOTP_ERROR` + += `setOrCreateChild()` method removed from JavaScript Admin Client + +The `groups.setOrCreateChild()` method has been removed from that JavaScript-based Admin Client. If you are still using this method then use the `createChildGroup()` or `updateChildGroup()` methods instead. diff --git a/js/libs/keycloak-admin-client/src/resources/groups.ts b/js/libs/keycloak-admin-client/src/resources/groups.ts index a46ef512c4..e1fe65086c 100644 --- a/js/libs/keycloak-admin-client/src/resources/groups.ts +++ b/js/libs/keycloak-admin-client/src/resources/groups.ts @@ -93,22 +93,6 @@ export class Groups extends Resource<{ realm?: string }> { path: "/count", }); - /** - * Set or create child. - * This will just set the parent if it exists. Create it and set the parent if the group doesn’t exist. - * @deprecated Use `createChildGroup` or `updateChildGroup` instead. - */ - public setOrCreateChild = this.makeUpdateRequest< - { id: string }, - GroupRepresentation, - { id: string } - >({ - method: "POST", - path: "/{id}/children", - urlParamKeys: ["id"], - returnResourceIdInLocationHeader: { field: "id" }, - }); - /** * Creates a child group on the specified parent group. If the group already exists, then an error is returned. */ diff --git a/js/libs/keycloak-admin-client/test/groups.spec.ts b/js/libs/keycloak-admin-client/test/groups.spec.ts index 92ed4c0c4e..c646e7f77a 100644 --- a/js/libs/keycloak-admin-client/test/groups.spec.ts +++ b/js/libs/keycloak-admin-client/test/groups.spec.ts @@ -81,22 +81,6 @@ describe("Groups", () => { }); }); - it("set or create child", async () => { - const groupName = "child-group"; - const groupId = currentGroup.id; - const childGroup = await kcAdminClient.groups.setOrCreateChild( - { id: groupId! }, - { name: groupName }, - ); - - expect(childGroup.id).to.be.ok; - - const group = (await kcAdminClient.groups.findOne({ - id: groupId!, - }))!; - expect(group).to.be.ok; - }); - it("list subgroups", async () => { if (currentGroup.id) { const args: SubGroupQuery = {