From fc342cbf7b042b4d005b88a65525aeb59f18ab82 Mon Sep 17 00:00:00 2001 From: "Kristen.Herum" Date: Fri, 20 Dec 2024 08:29:50 +0100 Subject: [PATCH] Refactor organization processing logic in service layer #deploy-altinn3-tilgang-service-prod #deploy-altinn3-tilgang-service Removed unnecessary mapping and flattening of subunits from the organization processing pipeline. This simplifies the logic and improves readability without affecting the core functionality. Adjustments focus on streamlining filters and data transformation. --- .../service/AltinnBrukerTilgangService.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/apps/altinn3-tilgang-service/src/main/java/no/nav/testnav/altinn3tilgangservice/service/AltinnBrukerTilgangService.java b/apps/altinn3-tilgang-service/src/main/java/no/nav/testnav/altinn3tilgangservice/service/AltinnBrukerTilgangService.java index a2c6641bd5a..ba468bb4273 100644 --- a/apps/altinn3-tilgang-service/src/main/java/no/nav/testnav/altinn3tilgangservice/service/AltinnBrukerTilgangService.java +++ b/apps/altinn3-tilgang-service/src/main/java/no/nav/testnav/altinn3tilgangservice/service/AltinnBrukerTilgangService.java @@ -14,9 +14,6 @@ import java.util.List; -import static org.apache.commons.lang3.BooleanUtils.isFalse; -import static org.apache.commons.lang3.StringUtils.isNotBlank; - @Slf4j @Service @RequiredArgsConstructor @@ -37,10 +34,6 @@ private Flux getOrganisasjon(Tuple2, L return Flux.fromIterable(organisasjoner.getT1()) .doOnNext(org -> log.info("Organisasjon {}", org)) -// .filter(party -> organisasjoner.getT2().stream() -// .anyMatch(organisasjon -> organisasjon.getOrganisasjonsnummer().equals(party.getOrganizationNumber()))) - .map(AuthorizedPartyDTO::getSubunits) - .flatMap(Flux::fromIterable) .filter(party -> party.getAuthorizedResources().contains(DOLLY_RESOURCE)) .filter(party -> organisasjoner.getT2().stream() .anyMatch(organisasjon -> organisasjon.getOrganisasjonsnummer().equals(party.getOrganizationNumber()))) @@ -67,8 +60,6 @@ public Mono getPersonOrganisasjonDetaljertTilgang(String ident) { private Flux getTilpassetOrganisasjon(Tuple2, List> organisasjoner) { return Flux.fromIterable(organisasjoner.getT1()) - .map(AuthorizedPartyDTO::getSubunits) - .flatMap(Flux::fromIterable) .map(party -> PersonDTO.OrganisasjonDTO.builder() .navn(party.getName()) .organisasjonsnummer(party.getOrganizationNumber())