diff --git a/services/src/main/java/org/keycloak/services/resources/admin/UserResource.java b/services/src/main/java/org/keycloak/services/resources/admin/UserResource.java index 23ba34ad90..b39e93e3c4 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/UserResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/UserResource.java @@ -188,11 +188,10 @@ public class UserResource { session.getProvider(BruteForceProtector.class).cleanUpPermanentLockout(session, realm, user); } - adminEvent.operation(OperationType.UPDATE).resourcePath(session.getContext().getUri()).representation(rep).success(); - if (session.getTransactionManager().isActive()) { session.getTransactionManager().commit(); } + adminEvent.operation(OperationType.UPDATE).resourcePath(session.getContext().getUri()).representation(rep).success(); return Response.noContent().build(); } catch (ModelDuplicateException e) { return ErrorResponse.exists("User exists with same username or email"); diff --git a/services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java b/services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java index 8734cd4a9d..f930980ecd 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java @@ -161,12 +161,11 @@ public class UsersResource { RepresentationToModel.createGroups(rep, realm, user); RepresentationToModel.createCredentials(rep, session, realm, user, true); - adminEvent.operation(OperationType.CREATE).resourcePath(session.getContext().getUri(), user.getId()).representation(rep).success(); if (session.getTransactionManager().isActive()) { session.getTransactionManager().commit(); } - + adminEvent.operation(OperationType.CREATE).resourcePath(session.getContext().getUri(), user.getId()).representation(rep).success(); return Response.created(session.getContext().getUri().getAbsolutePathBuilder().path(user.getId()).build()).build(); } catch (ModelDuplicateException e) { if (session.getTransactionManager().isActive()) {