When merging users delete the remaining credentials of the user to be

merged
This commit is contained in:
George Kalampokis 2020-10-29 12:08:09 +02:00
parent d77fefc7c5
commit 03da1f3f7b
1 changed files with 6 additions and 0 deletions

View File

@ -91,6 +91,12 @@ public class MergeEmailConfirmationManager {
}); });
oldUser.setUserStatus((short)1); oldUser.setUserStatus((short)1);
oldUser.setEmail(null); oldUser.setEmail(null);
List<Credential> credentials = databaseRepository.getCredentialDao().asQueryable().where((builder, root) -> builder.equal(root.get("userInfo"), oldUser)).toList();
credentials.forEach(cred -> {
if (cred.getId() != credential.getId()) {
databaseRepository.getCredentialDao().delete(cred);
}
});
databaseRepository.getUserInfoDao().createOrUpdate(oldUser); databaseRepository.getUserInfoDao().createOrUpdate(oldUser);
} }