update groups on user creation

This commit is contained in:
Hugo Renard 2022-09-22 10:50:12 +02:00
parent a593351568
commit a7977de788
Signed by: hougo
GPG key ID: 3A285FD470209C59

View file

@ -54,6 +54,9 @@ public class ScimEventListenerProvider implements EventListenerProvider {
if (event.getOperationType() == OperationType.CREATE) { if (event.getOperationType() == OperationType.CREATE) {
var user = getUser(userId); var user = getUser(userId);
dispatcher.run(ScimDispatcher.SCOPE_USER, (client) -> client.create(UserAdapter.class, user)); dispatcher.run(ScimDispatcher.SCOPE_USER, (client) -> client.create(UserAdapter.class, user));
user.getGroupsStream().forEach(group -> {
dispatcher.run(ScimDispatcher.SCOPE_GROUP, (client) -> client.replace(GroupAdapter.class, group));
});
} }
if (event.getOperationType() == OperationType.UPDATE) { if (event.getOperationType() == OperationType.UPDATE) {
var user = getUser(userId); var user = getUser(userId);