From ac51ce0370a53424060389ed7de900d2c6576113 Mon Sep 17 00:00:00 2001 From: Erling Jahr Date: Wed, 10 Jan 2024 12:58:12 +0100 Subject: [PATCH] FKS-609 #comment status updated by accountEnabled field from Azure for external users #done --- .../fintlabs/externalUser/ExternalUser.java | 26 +---------------- .../externalUser/ExternalUserService.java | 29 ------------------- 2 files changed, 1 insertion(+), 54 deletions(-) diff --git a/src/main/java/no/fintlabs/externalUser/ExternalUser.java b/src/main/java/no/fintlabs/externalUser/ExternalUser.java index c3a2cfb..40af8aa 100644 --- a/src/main/java/no/fintlabs/externalUser/ExternalUser.java +++ b/src/main/java/no/fintlabs/externalUser/ExternalUser.java @@ -51,34 +51,10 @@ public User toUser(){ .mainOrganisationUnitId(mainOrganisationUnitId) .email(email) .mobilePhone(mobilePhone) + .status(accountEnabled?"ACTIV" :"DISABLED") .build(); } - - - - - public SimpelExternalUser toSimpleExternalUser() { - return SimpelExternalUser - .builder() - .id(id) - .fullName(firstName + " " + lastName) - .userType(userType) - .organisationUnitName(mainOrganisationUnitName) - .organisationUnitId(mainOrganisationUnitId) - .build(); - } - - public DetailedExternalUser toDetailedExternalUser(){ - return DetailedExternalUser - .builder() - .id(id) - .fullName(firstName +" "+ lastName) - .organisationUnitName(mainOrganisationUnitName) - .mobilePhone(mobilePhone) - .email(email) - .build(); - } } diff --git a/src/main/java/no/fintlabs/externalUser/ExternalUserService.java b/src/main/java/no/fintlabs/externalUser/ExternalUserService.java index ce47718..c1e3f06 100644 --- a/src/main/java/no/fintlabs/externalUser/ExternalUserService.java +++ b/src/main/java/no/fintlabs/externalUser/ExternalUserService.java @@ -15,35 +15,6 @@ public ExternalUserService(UserService userService) { this.userService = userService; } -// public void save(ExternalUser externalUser) { -// externalUserRepository -// .findExternalUserByIdentityProviderUserObjectId(externalUser.getIdentityProviderUserObjectId()) -// .ifPresentOrElse(onSaveExistingExternalUser(externalUser), onSaveNewExternalUser(externalUser)); -// } -// -// private Runnable onSaveNewExternalUser(ExternalUser externalUser){ -// return ()-> { -// ExternalUser newExternalUser = externalUserRepository.save(externalUser); -// log.info("Created new external user" + newExternalUser.getUserName()); -// }; -// } -// -// private Consumer onSaveExistingExternalUser(ExternalUser externalUser){ -// return existingExternalUser -> { -// externalUser.setId(existingExternalUser.getId()); -// log.info("Updating external user " + externalUser.getUserName()); -// externalUserRepository.save(externalUser); -// }; -// } -// -// public Optional getExternalUserById(Long id){ -// return externalUserRepository.findById(id); -// } -// -// public List getAllExternalUsers(){ -// return null; -// } - public void convertAndSaveAsUser(ExternalUser externalUser) { User convertedExternalUser = externalUser.toUser();