KEYCLOAK-2947: Include group representation for GroupMembership changes in AdminEvents

We now include the full group representation in AdminEvents
for Group Membership changes.
This enables EventListener to propagate potential role / attribute
chnages based on the removal / addition of the group.
This commit is contained in:
Thomas Darimont 2016-04-29 09:58:54 +02:00 committed by mposolda
parent f58936025f
commit 5f73c338d8

View file

@ -959,7 +959,7 @@ public class UsersResource {
try {
if (user.isMemberOf(group)){
user.leaveGroup(group);
adminEvent.operation(OperationType.DELETE).resourcePath(uriInfo).success();
adminEvent.operation(OperationType.DELETE).representation(ModelToRepresentation.toRepresentation(group, true)).resourcePath(uriInfo).success();
}
} catch (ModelException me) {
Properties messages = AdminRoot.getMessages(session, realm, auth.getAuth().getToken().getLocale());
@ -984,9 +984,8 @@ public class UsersResource {
}
if (!user.isMemberOf(group)){
user.joinGroup(group);
adminEvent.operation(OperationType.CREATE).resourcePath(uriInfo).success();
adminEvent.operation(OperationType.CREATE).representation(ModelToRepresentation.toRepresentation(group, true)).resourcePath(uriInfo).success();
}
}
}