Remove unnecessary lookup of an entity via the session

Closes #11744
This commit is contained in:
Alexander Schwartz 2022-10-24 15:39:47 +02:00 committed by Hynek Mlnařík
parent cac4c43052
commit 9f95b6ec63

View file

@ -353,9 +353,7 @@ public class MapClientProvider implements ClientProvider {
try (Stream<MapClientEntity> toRemove = tx.read(withCriteria(mcb))) { try (Stream<MapClientEntity> toRemove = tx.read(withCriteria(mcb))) {
toRemove toRemove
.map(clientEntity -> session.clients().getClientById(realm, clientEntity.getId())) .forEach(clientEntity -> clientEntity.removeScopeMapping(role.getId()));
.filter(Objects::nonNull)
.forEach(clientModel -> clientModel.deleteScopeMapping(role));
} }
} }