diff --git a/src/main/java/biz/nynja/account/repositories/AccountRepositoryAdditionalImpl.java b/src/main/java/biz/nynja/account/repositories/AccountRepositoryAdditionalImpl.java index b541a36dd5a4b04af9ac1bd19b24b1c4801dd79f..1b11b636a7b39d1b1f16fc5affd7f0419a717448 100644 --- a/src/main/java/biz/nynja/account/repositories/AccountRepositoryAdditionalImpl.java +++ b/src/main/java/biz/nynja/account/repositories/AccountRepositoryAdditionalImpl.java @@ -290,7 +290,8 @@ public class AccountRepositoryAdditionalImpl implements AccountRepositoryAdditio String accessToken = accessPoint.getAccessToken(); DecodedJWT decodedToken = JWT.decode(accessToken); List accesspointRoles = getRolesFromAccessToken(decodedToken); - if (accesspointRoles.contains(Role.ACCOUNT_ADMIN.name()) || accesspointRoles.contains(Role.AUTHENTICATION_ADMIN.name())) { + if (accesspointRoles.contains(Role.ACCOUNT_ADMIN.name()) + || accesspointRoles.contains(Role.AUTHENTICATION_ADMIN.name())) { if (!accessPointService.deleteAccessPoint(UUID.fromString(accountId), accessToken)) { logger.error("Error deleting accesspoint record from DB for account with id {} and role {}.", accountId, Role.ACCOUNT_ADMIN.name()); @@ -583,7 +584,8 @@ public class AccountRepositoryAdditionalImpl implements AccountRepositoryAdditio Account existingAccount = accountRepository.findByAccountId(accountByProfileId.getAccountId()); deleteAccountData(batchOperations, existingAccount); if (!accessPointService.deleteAccessPointsForAccount(accountByProfileId.getAccountId())) { - logger.error("Error deleting accesspoints from the DB for account {}.", accountByProfileId.getAccountId()); + logger.error("Error deleting accesspoints from the DB for account {}.", + accountByProfileId.getAccountId()); } } diff --git a/src/main/java/biz/nynja/account/services/AccountServiceImpl.java b/src/main/java/biz/nynja/account/services/AccountServiceImpl.java index 4c2f0d213a0953e297239d0b748d3e373ac6566a..945176bb64fa9ffae8dffa6dbfb573e4915d28a3 100644 --- a/src/main/java/biz/nynja/account/services/AccountServiceImpl.java +++ b/src/main/java/biz/nynja/account/services/AccountServiceImpl.java @@ -20,6 +20,7 @@ import org.slf4j.LoggerFactory; import biz.nynja.account.accesspoints.AccessPointService; import biz.nynja.account.configuration.ProfileDataConfiguration; +import biz.nynja.account.grpc.AccessStatus; import biz.nynja.account.grpc.AccountByAccountIdRequest; import biz.nynja.account.grpc.AccountResponse; import biz.nynja.account.grpc.AccountServiceGrpc; @@ -523,6 +524,11 @@ public class AccountServiceImpl extends AccountServiceGrpc.AccountServiceImplBas request.getAccountId(), Cause.INVALID_ACCOUNT_ID, "Invalid Account ID"); return; } + if (request.getAccessStatus().equals(AccessStatus.UNKNOWN_ACCESS_STATUS)) { + logAndBuildGrpcAccountResponse(responseObserver, AccountResponse.newBuilder(), "Invalid access status for account id: {}", + request.getAccountId(), Cause.INVALID_ACCESS_STATUS, "Invalid access status"); + return; + } if (!permissionsValidator.isRpcAllowed(request.getAccountId())) { logAndBuildGrpcAccountResponse(responseObserver, AccountResponse.newBuilder(), "Can not update account {}.", @@ -1069,7 +1075,7 @@ public class AccountServiceImpl extends AccountServiceGrpc.AccountServiceImplBas return searchResultDetails.build(); } - //Currently not supported + // Currently not supported @Override @PerformPermissionCheck @Permitted(role = RoleConstants.ACCOUNT_ADMIN)