preRemove
This commit is contained in:
parent
00d439b6f0
commit
db852f7e11
1 changed files with 5 additions and 0 deletions
|
@ -34,6 +34,7 @@ import org.keycloak.models.jpa.entities.GroupEntity;
|
|||
import org.keycloak.models.jpa.entities.RealmEntity;
|
||||
import org.keycloak.models.jpa.entities.RoleEntity;
|
||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||
import org.keycloak.storage.StorageProviderModel;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.TypedQuery;
|
||||
|
@ -127,6 +128,9 @@ public class JpaRealmProvider implements RealmProvider {
|
|||
em.refresh(realm);
|
||||
final RealmAdapter adapter = new RealmAdapter(session, em, realm);
|
||||
session.users().preRemove(adapter);
|
||||
for (StorageProviderModel provider : adapter.getStorageProviders()) {
|
||||
adapter.removeStorageProvider(provider);
|
||||
}
|
||||
|
||||
realm.getDefaultGroups().clear();
|
||||
em.flush();
|
||||
|
@ -153,6 +157,7 @@ public class JpaRealmProvider implements RealmProvider {
|
|||
session.realms().removeRole(adapter, role);
|
||||
}
|
||||
|
||||
|
||||
em.remove(realm);
|
||||
|
||||
em.flush();
|
||||
|
|
Loading…
Reference in a new issue