KEYCLOAK-17189 - fixed NPE during migration due to missed "account" client

This commit is contained in:
Oleksandr Kochubei 2021-02-19 13:31:03 +02:00 committed by Hynek Mlnařík
parent 9356843c6c
commit 63b19389c1

View file

@ -45,6 +45,7 @@ public class MigrateTo12_0_0 implements Migration {
session.realms()
.getRealmsStream()
.map(realm -> realm.getClientByClientId(Constants.ACCOUNT_MANAGEMENT_CLIENT_ID))
.filter(Objects::nonNull)
.filter(client -> Objects.isNull(client.getRole(AccountRoles.DELETE_ACCOUNT)))
.forEach(client -> client.addRole(AccountRoles.DELETE_ACCOUNT)
.setDescription("${role_" + AccountRoles.DELETE_ACCOUNT + "}"));