confirmRemoveCredential changes
This commit is contained in:
parent
37aa6061a4
commit
b04c0aebab
|
@ -16,6 +16,7 @@ import eu.eudat.commons.types.actionconfirmation.MergeAccountConfirmationEntity;
|
||||||
import eu.eudat.commons.types.actionconfirmation.RemoveCredentialRequestEntity;
|
import eu.eudat.commons.types.actionconfirmation.RemoveCredentialRequestEntity;
|
||||||
import eu.eudat.commons.types.notification.*;
|
import eu.eudat.commons.types.notification.*;
|
||||||
import eu.eudat.commons.types.user.AdditionalInfoEntity;
|
import eu.eudat.commons.types.user.AdditionalInfoEntity;
|
||||||
|
import eu.eudat.commons.types.usercredential.UserCredentialDataEntity;
|
||||||
import eu.eudat.commons.validation.ValidatorFactory;
|
import eu.eudat.commons.validation.ValidatorFactory;
|
||||||
import eu.eudat.configurations.notification.NotificationProperties;
|
import eu.eudat.configurations.notification.NotificationProperties;
|
||||||
import eu.eudat.convention.ConventionService;
|
import eu.eudat.convention.ConventionService;
|
||||||
|
@ -29,10 +30,7 @@ import eu.eudat.model.User;
|
||||||
import eu.eudat.model.UserContactInfo;
|
import eu.eudat.model.UserContactInfo;
|
||||||
import eu.eudat.model.UserCredential;
|
import eu.eudat.model.UserCredential;
|
||||||
import eu.eudat.model.builder.UserBuilder;
|
import eu.eudat.model.builder.UserBuilder;
|
||||||
import eu.eudat.model.deleter.UserCredentialDeleter;
|
import eu.eudat.model.deleter.*;
|
||||||
import eu.eudat.model.deleter.UserDeleter;
|
|
||||||
import eu.eudat.model.deleter.UserRoleDeleter;
|
|
||||||
import eu.eudat.model.deleter.UserSettingsSettingsDeleter;
|
|
||||||
import eu.eudat.model.persist.*;
|
import eu.eudat.model.persist.*;
|
||||||
import eu.eudat.model.persist.actionconfirmation.MergeAccountConfirmationPersist;
|
import eu.eudat.model.persist.actionconfirmation.MergeAccountConfirmationPersist;
|
||||||
import eu.eudat.model.persist.actionconfirmation.RemoveCredentialRequestPersist;
|
import eu.eudat.model.persist.actionconfirmation.RemoveCredentialRequestPersist;
|
||||||
|
@ -595,6 +593,14 @@ public class UserServiceImpl implements UserService {
|
||||||
|
|
||||||
if (!this.userScope.getUserIdSafe().equals(userCredentialEntity.getId())) throw new MyForbiddenException("Only requested user can approve");
|
if (!this.userScope.getUserIdSafe().equals(userCredentialEntity.getId())) throw new MyForbiddenException("Only requested user can approve");
|
||||||
|
|
||||||
|
if (userCredentialEntity.getData() != null){
|
||||||
|
UserCredentialDataEntity userCredentialDataEntity = this.jsonHandlingService.fromJsonSafe(UserCredentialDataEntity.class, userCredentialEntity.getData());
|
||||||
|
if (userCredentialDataEntity != null && !this.conventionService.isNullOrEmpty(userCredentialDataEntity.getEmail())) {
|
||||||
|
List<UserContactInfoEntity> userContactInfos = this.queryFactory.query(UserContactInfoQuery.class).values(userCredentialDataEntity.getEmail()).userIds(userCredentialEntity.getUserId()).collect();
|
||||||
|
if (!this.conventionService.isListNullOrEmpty(userContactInfos))
|
||||||
|
this.deleterFactory.deleter(UserContactInfoDeleter.class).delete(userContactInfos);
|
||||||
|
}
|
||||||
|
}
|
||||||
this.deleterFactory.deleter(UserCredentialDeleter.class).delete(List.of(userCredentialEntity));
|
this.deleterFactory.deleter(UserCredentialDeleter.class).delete(List.of(userCredentialEntity));
|
||||||
|
|
||||||
action.setUpdatedAt(Instant.now());
|
action.setUpdatedAt(Instant.now());
|
||||||
|
|
Loading…
Reference in New Issue