Implement AbstractClientEntity.isUpdated to account for changes in associated protocol mappers.

Closes #10927
This commit is contained in:
Stefan Guilhen 2022-03-28 18:52:14 -03:00 committed by Hynek Mlnařík
parent 19e55650a2
commit d8bee26ec8

View file

@ -20,9 +20,11 @@ import org.keycloak.models.map.common.AbstractEntity;
import org.keycloak.models.map.common.EntityWithAttributes;
import org.keycloak.models.map.common.UpdatableEntity;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Stream;
import org.keycloak.models.map.annotations.GenerateEntityImplementations;
@ -54,6 +56,12 @@ public interface MapClientEntity extends AbstractEntity, UpdatableEntity, Entity
this.updated |= id != null;
}
@Override
public boolean isUpdated() {
return this.updated
|| Optional.ofNullable(getProtocolMappers()).orElseGet(Collections::emptyMap).values().stream().anyMatch(MapProtocolMapperEntity::isUpdated);
}
@Override
public Stream<String> getClientScopes(boolean defaultScope) {
final Map<String, Boolean> clientScopes = getClientScopes();