diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/AddressController.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/AddressController.kt index 75df19409..37118a6ce 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/AddressController.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/AddressController.kt @@ -27,7 +27,6 @@ import org.eclipse.tractusx.bpdm.gate.api.model.AddressGateInputResponse import org.eclipse.tractusx.bpdm.gate.api.model.AddressGateOutputRequest import org.eclipse.tractusx.bpdm.gate.api.model.AddressGateOutputResponse import org.eclipse.tractusx.bpdm.gate.config.ApiConfigProperties -import org.eclipse.tractusx.bpdm.gate.config.GateSecurityConfigProperties import org.eclipse.tractusx.bpdm.gate.containsDuplicates import org.eclipse.tractusx.bpdm.gate.service.AddressService import org.springframework.http.HttpStatus @@ -38,8 +37,7 @@ import org.springframework.web.bind.annotation.RestController @RestController class AddressController( private val addressService: AddressService, - private val apiConfigProperties: ApiConfigProperties, - val gateSecurityConfigProperties: GateSecurityConfigProperties + private val apiConfigProperties: ApiConfigProperties ) : GateAddressApi { @@ -61,7 +59,7 @@ class AddressController( @PreAuthorize("hasAuthority(@gateSecurityConfigProperties.getReadCompanyInputDataAsRole())") override fun getAddressByExternalId(externalId: String): AddressGateInputResponse { - gateSecurityConfigProperties.getReadCompanyOutputDataAsRole() + return addressService.getAddressByExternalId(externalId) } diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangelogController.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangelogController.kt index 99ff15003..7acedae9c 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangelogController.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/ChangelogController.kt @@ -25,7 +25,6 @@ import org.eclipse.tractusx.bpdm.gate.api.GateChangelogApi import org.eclipse.tractusx.bpdm.gate.api.model.request.ChangeLogSearchRequest import org.eclipse.tractusx.bpdm.gate.api.model.response.ChangelogResponse import org.eclipse.tractusx.bpdm.gate.api.model.response.PageChangeLogResponse -import org.eclipse.tractusx.bpdm.gate.config.GateSecurityConfigProperties import org.eclipse.tractusx.bpdm.gate.service.ChangelogService import org.springframework.security.access.prepost.PreAuthorize import org.springframework.validation.annotation.Validated @@ -34,8 +33,7 @@ import org.springframework.web.bind.annotation.RestController @RestController @Validated class ChangelogController( - private val changelogService: ChangelogService, - val gateSecurityConfigProperties: GateSecurityConfigProperties + private val changelogService: ChangelogService ) : GateChangelogApi { @PreAuthorize("hasAuthority(@gateSecurityConfigProperties.getReadCompanyInputDataAsRole())") @@ -48,7 +46,6 @@ class ChangelogController( @PreAuthorize("hasAuthority(@gateSecurityConfigProperties.getReadCompanyOutputDataAsRole())") override fun getOutputChangelog(paginationRequest: PaginationRequest, searchRequest: ChangeLogSearchRequest): PageChangeLogResponse { - return changelogService.getChangeLogEntries(searchRequest.externalIds, searchRequest.lsaTypes, searchRequest.fromTime,OutputInputEnum.Output, paginationRequest.page, paginationRequest.size) } diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityController.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityController.kt index ac08f177b..e7b51f18d 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityController.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/LegalEntityController.kt @@ -27,7 +27,6 @@ import org.eclipse.tractusx.bpdm.gate.api.model.LegalEntityGateInputResponse import org.eclipse.tractusx.bpdm.gate.api.model.LegalEntityGateOutputRequest import org.eclipse.tractusx.bpdm.gate.api.model.LegalEntityGateOutputResponse import org.eclipse.tractusx.bpdm.gate.config.ApiConfigProperties -import org.eclipse.tractusx.bpdm.gate.config.GateSecurityConfigProperties import org.eclipse.tractusx.bpdm.gate.containsDuplicates import org.eclipse.tractusx.bpdm.gate.service.LegalEntityService import org.springframework.http.HttpStatus @@ -38,8 +37,7 @@ import org.springframework.web.bind.annotation.RestController @RestController class LegalEntityController( val legalEntityService: LegalEntityService, - val apiConfigProperties: ApiConfigProperties, - val gateSecurityConfigProperties: GateSecurityConfigProperties + val apiConfigProperties: ApiConfigProperties ) : GateLegalEntityApi { @PreAuthorize("hasAuthority(@gateSecurityConfigProperties.getChangeCompanyInputDataAsRole())") override fun upsertLegalEntities(legalEntities: Collection): ResponseEntity { diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/SharingStateController.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/SharingStateController.kt index 26237825d..58d105ab3 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/SharingStateController.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/SharingStateController.kt @@ -25,25 +25,22 @@ import org.eclipse.tractusx.bpdm.common.dto.response.PageResponse import org.eclipse.tractusx.bpdm.gate.api.GateSharingStateApi import org.eclipse.tractusx.bpdm.gate.api.model.LsaType import org.eclipse.tractusx.bpdm.gate.api.model.SharingStateDto -import org.eclipse.tractusx.bpdm.gate.config.GateSecurityConfigProperties import org.eclipse.tractusx.bpdm.gate.service.SharingStateService import org.springframework.security.access.prepost.PreAuthorize import org.springframework.web.bind.annotation.RestController @RestController class SharingStateController( - val sharingStateService: SharingStateService, - val gateSecurityConfigProperties: GateSecurityConfigProperties + val sharingStateService: SharingStateService ) : GateSharingStateApi { - private val logger = KotlinLogging.logger { } - @PreAuthorize("hasAuthority(gateSecurityConfigProperties.getReadCompanyOutputDataAsRole())") + @PreAuthorize("hasAuthority(@gateSecurityConfigProperties.getReadCompanyOutputDataAsRole())") override fun getSharingStates(paginationRequest: PaginationRequest, lsaType: LsaType?, externalIds: Collection?): PageResponse { return sharingStateService.findSharingStates(paginationRequest, lsaType, externalIds) } - @PreAuthorize("hasAuthority(gateSecurityConfigProperties.getChangeCompanyOutputDataAsRole())") + @PreAuthorize("hasAuthority(@gateSecurityConfigProperties.getChangeCompanyOutputDataAsRole())") override fun upsertSharingState(request: SharingStateDto) { logger.info { "upsertSharingState() called with $request" } sharingStateService.upsertSharingState(request) diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/SiteController.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/SiteController.kt index 4914c88b9..379ad03a7 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/SiteController.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/controller/SiteController.kt @@ -27,7 +27,6 @@ import org.eclipse.tractusx.bpdm.gate.api.model.SiteGateInputResponse import org.eclipse.tractusx.bpdm.gate.api.model.SiteGateOutputRequest import org.eclipse.tractusx.bpdm.gate.api.model.SiteGateOutputResponse import org.eclipse.tractusx.bpdm.gate.config.ApiConfigProperties -import org.eclipse.tractusx.bpdm.gate.config.GateSecurityConfigProperties import org.eclipse.tractusx.bpdm.gate.containsDuplicates import org.eclipse.tractusx.bpdm.gate.service.SiteService import org.springframework.http.HttpStatus @@ -38,8 +37,7 @@ import org.springframework.web.bind.annotation.RestController @RestController class SiteController( val siteService: SiteService, - val apiConfigProperties: ApiConfigProperties, - val gateSecurityConfigProperties: GateSecurityConfigProperties + val apiConfigProperties: ApiConfigProperties ) : GateSiteApi {