Merge pull request #2748 from thomasdarimont/issue/KEYCLOAK-2924-AdminEvents-on-group-membership-changes
KEYCLOAK-2924: Fire AdminEvents on user group membership changes.
This commit is contained in:
commit
acba6cd210
1 changed files with 8 additions and 2 deletions
|
@ -960,7 +960,10 @@ public class UsersResource {
|
|||
}
|
||||
|
||||
try {
|
||||
if (user.isMemberOf(group)) user.leaveGroup(group);
|
||||
if (user.isMemberOf(group)){
|
||||
user.leaveGroup(group);
|
||||
adminEvent.operation(OperationType.DELETE).resourcePath(uriInfo).success();
|
||||
}
|
||||
} catch (ModelException me) {
|
||||
Properties messages = AdminRoot.getMessages(session, realm, auth.getAuth().getToken().getLocale());
|
||||
throw new ErrorResponseException(me.getMessage(), MessageFormat.format(messages.getProperty(me.getMessage(), me.getMessage()), me.getParameters()),
|
||||
|
@ -982,7 +985,10 @@ public class UsersResource {
|
|||
if (group == null) {
|
||||
throw new NotFoundException("Group not found");
|
||||
}
|
||||
if (!user.isMemberOf(group)) user.joinGroup(group);
|
||||
if (!user.isMemberOf(group)){
|
||||
user.joinGroup(group);
|
||||
adminEvent.operation(OperationType.CREATE).resourcePath(uriInfo).success();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue