Skip to content

Commit

Permalink
test: update user
Browse files Browse the repository at this point in the history
  • Loading branch information
ferruhcihan committed Sep 27, 2024
1 parent b720b98 commit 008fb62
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/operator/keycloak.ts
Original file line number Diff line number Diff line change
Expand Up @@ -720,10 +720,13 @@ async function createUpdateUser(api: any, user: any) {

try {
if (existingUser) {
console.log('existingUser', existingUser)
console.debug(`User with email ${email} already exists, updating user`)
const userConfWithoutCredentials = omit(userConf, ['credentials'])
const updatedUserConf = existingUser.requiredActions?.includes('UPDATE_PASSWORD')
? userConf
: omit(userConf, ['credentials'])
await doApiCall(errors, `Updating user ${username}`, async () =>
api.users.realmUsersIdPut(keycloakRealm, existingUser.id as string, userConfWithoutCredentials),
api.users.realmUsersIdPut(keycloakRealm, existingUser.id as string, updatedUserConf),
)
} else {
await doApiCall(errors, `Creating user ${username}`, () => api.users.realmUsersPost(keycloakRealm, userConf))
Expand Down

0 comments on commit 008fb62

Please sign in to comment.