diff --git a/CHANGELOG.md b/CHANGELOG.md index 608febac49..a29e085968 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ _**For better traceability add the corresponding GitHub issue number in each cha - Fixed already merged implementation from _"Access and Usage Policy Validation flow correction. #757"_ where fallback to default policy was not implemented correctly. - Improved exception handling concerning invalid date format in search parameters for `GET /irs/policies/paged`. #639 +- Fix policy leftOperand prefix in IRS_Request_Collection.json and EdcRegistration.registerPolicy + (`https://w3id.org/catenax/policy` instead of `cx-policy`). ### Changed diff --git a/irs-api/src/main/java/org/eclipse/tractusx/irs/ess/service/EdcRegistration.java b/irs-api/src/main/java/org/eclipse/tractusx/irs/ess/service/EdcRegistration.java index aa404f485b..55ed459746 100644 --- a/irs-api/src/main/java/org/eclipse/tractusx/irs/ess/service/EdcRegistration.java +++ b/irs-api/src/main/java/org/eclipse/tractusx/irs/ess/service/EdcRegistration.java @@ -144,42 +144,42 @@ private void registerAsset(final String assetId, final String notificationType, private void registerPolicy(final String policyId) { final var body = """ - { - "@context": { - "@vocab": "https://w3id.org/edc/v0.0.1/ns/", - "cx-policy": "https://w3id.org/catenax/policy/", - "odrl": "http://www.w3.org/ns/odrl/2/" - }, - "@id": "%s", - "policy": { - "@type": "odrl:Set", - "odrl:permission": [ - { - "odrl:action": "use", - "odrl:constraint": { - "@type": "AtomicConstraint", - "odrl:and": [ - { - "odrl:leftOperand": "cx-policy:FrameworkAgreement", - "odrl:operator": { - "@id": "odrl:eq" - }, - "odrl:rightOperand": "traceability:1.0" - }, - { - "odrl:leftOperand": "cx-policy:UsagePurpose", - "odrl:operator": { - "@id": "odrl:eq" - }, - "odrl:rightOperand": "cx.core.industrycore:1" + { + "@context": { + "@vocab": "https://w3id.org/edc/v0.0.1/ns/", + "cx-policy": "https://w3id.org/catenax/policy/", + "odrl": "http://www.w3.org/ns/odrl/2/" + }, + "@id": "%s", + "policy": { + "@type": "odrl:Set", + "odrl:permission": [ + { + "odrl:action": "use", + "odrl:constraint": { + "@type": "AtomicConstraint", + "odrl:and": [ + { + "odrl:leftOperand": "https://w3id.org/catenax/policy/FrameworkAgreement", + "odrl:operator": { + "@id": "odrl:eq" + }, + "odrl:rightOperand": "traceability:1.0" + }, + { + "odrl:leftOperand": "https://w3id.org/catenax/policy/UsagePurpose", + "odrl:operator": { + "@id": "odrl:eq" + }, + "odrl:rightOperand": "cx.core.industrycore:1" + } + ] } - ] - } + } + ] } - ] - } - } - """.formatted(policyId); + } + """.formatted(policyId); final var entity = restTemplate.exchange(edcProviderUrl + policydefinitionsPath, HttpMethod.POST, toEntity(body), String.class); diff --git a/local/testing/request-collection/IRS_Request_Collection.json b/local/testing/request-collection/IRS_Request_Collection.json index 467b0c0d13..deb1e01206 100644 --- a/local/testing/request-collection/IRS_Request_Collection.json +++ b/local/testing/request-collection/IRS_Request_Collection.json @@ -3171,7 +3171,7 @@ "method": "POST", "body": { "mimeType": "application/json", - "text": "{\n\t\"edc:counterPartyAddress\": \"{{ _.PROVIDER_CONTROLPLANE_1 }}/api/v1/dsp\",\n\t\"edc:counterPartyId\": \"{{ _.PROVIDER_BPN }}\",\n\t\"edc:policy\": {\n\t\t\"@id\": \"YWZhOTZlMjYtY2JhMy00OTEzLWExZGQtMjZmNmUyNWNjZTZj:cmVnaXN0cnktYXNzZXQ=:NmFkOTc5NDgtNjYyOS00OThhLWFmZWUtNzBhYmUzNjQ5NDQ0\",\n\t\t\"@type\": \"odrl:Offer\",\n\t\t\"odrl:permission\": {\n\t\t\t\t\"odrl:action\": {\n\t\t\t\t\t\"odrl:type\": \"use\"\n\t\t\t\t},\n\t\t\t\t\"odrl:constraint\": {\n\t\t\t\t\t\"odrl:and\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"odrl:leftOperand\": \"cx-policy:FrameworkAgreement\",\n\t\t\t\t\t\t\t\"odrl:operator\": {\n\t\t\t\t\t\t\t\t\"@id\": \"odrl:eq\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"odrl:rightOperand\": \"Traceability:1.0\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"odrl:leftOperand\": \"cx-policy:UsagePurpose\",\n\t\t\t\t\t\t\t\"odrl:operator\": {\n\t\t\t\t\t\t\t\t\"@id\": \"odrl:eq\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"odrl:rightOperand\": \"cx.core.industrycore:1\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t},\n\t\t\"odrl:prohibition\": [],\n\t\t\"odrl:obligation\": [],\n\t\t\"odrl:assigner\": {\n\t\t\t\"@id\": \"{{ _.PROVIDER_BPN }}\"\n\t\t},\n\t\t\"odrl:target\": {\n\t\t\t\"@id\": \"registry-asset\"\n\t\t}\n\t},\n\t\"edc:protocol\": \"dataspace-protocol-http\",\n\t\"edc:callbackAddresses\": [],\n\t\"@context\": {\n\t\t\"odrl\": \"http://www.w3.org/ns/odrl/2/\",\n\t\t\"dct\": \"https://purl.org/dc/terms/\",\n\t\t\"tx\": \"https://w3id.org/tractusx/v0.0.1/ns/\",\n\t\t\"edc\": \"https://w3id.org/edc/v0.0.1/ns/\",\n\t\t\"dcat\": \"https://www.w3.org/ns/dcat/\",\n\t\t\"dspace\": \"https://w3id.org/dspace/v0.8/\"\n\t}\n}" + "text": "{\n\t\"edc:counterPartyAddress\": \"{{ _.PROVIDER_CONTROLPLANE_1 }}/api/v1/dsp\",\n\t\"edc:counterPartyId\": \"{{ _.PROVIDER_BPN }}\",\n\t\"edc:policy\": {\n\t\t\"@id\": \"YWZhOTZlMjYtY2JhMy00OTEzLWExZGQtMjZmNmUyNWNjZTZj:cmVnaXN0cnktYXNzZXQ=:NmFkOTc5NDgtNjYyOS00OThhLWFmZWUtNzBhYmUzNjQ5NDQ0\",\n\t\t\"@type\": \"odrl:Offer\",\n\t\t\"odrl:permission\": {\n\t\t\t\t\"odrl:action\": {\n\t\t\t\t\t\"odrl:type\": \"use\"\n\t\t\t\t},\n\t\t\t\t\"odrl:constraint\": {\n\t\t\t\t\t\"odrl:and\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"odrl:leftOperand\": \"https://w3id.org/catenax/policy/FrameworkAgreement\",\n\t\t\t\t\t\t\t\"odrl:operator\": {\n\t\t\t\t\t\t\t\t\"@id\": \"odrl:eq\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"odrl:rightOperand\": \"Traceability:1.0\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"odrl:leftOperand\": \"https://w3id.org/catenax/policy/UsagePurpose\",\n\t\t\t\t\t\t\t\"odrl:operator\": {\n\t\t\t\t\t\t\t\t\"@id\": \"odrl:eq\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"odrl:rightOperand\": \"cx.core.industrycore:1\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t},\n\t\t\"odrl:prohibition\": [],\n\t\t\"odrl:obligation\": [],\n\t\t\"odrl:assigner\": {\n\t\t\t\"@id\": \"{{ _.PROVIDER_BPN }}\"\n\t\t},\n\t\t\"odrl:target\": {\n\t\t\t\"@id\": \"registry-asset\"\n\t\t}\n\t},\n\t\"edc:protocol\": \"dataspace-protocol-http\",\n\t\"edc:callbackAddresses\": [],\n\t\"@context\": {\n\t\t\"odrl\": \"http://www.w3.org/ns/odrl/2/\",\n\t\t\"dct\": \"https://purl.org/dc/terms/\",\n\t\t\"tx\": \"https://w3id.org/tractusx/v0.0.1/ns/\",\n\t\t\"edc\": \"https://w3id.org/edc/v0.0.1/ns/\",\n\t\t\"dcat\": \"https://www.w3.org/ns/dcat/\",\n\t\t\"dspace\": \"https://w3id.org/dspace/v0.8/\"\n\t}\n}" }, "preRequestScript": "", "parameters": [], @@ -3830,7 +3830,7 @@ "method": "POST", "body": { "mimeType": "application/json", - "text": "{\n\t\"@context\": {\n\t\t\"odrl\": \"http://www.w3.org/ns/odrl/2/\"\n\t},\n\t\"@id\": \"test123\",\n\t\"policy\": {\n\t\t\"@type\": \"odrl:Set\",\n\t\t\"odrl:permission\": [\n\t\t\t{\n\t\t\t\t\"odrl:action\": \"use\",\n\t\t\t\t\"odrl:constraint\": {\n\t\t\t\t\t\"@type\": \"AtomicConstraint\",\n\t\t\t\t\t\"odrl:and\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"odrl:leftOperand\": \"cx-policy:FrameworkAgreement\",\n\t\t\t\t\t\t\t\"odrl:operator\": {\n\t\t\t\t\t\t\t\t\"@id\": \"odrl:eq\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"odrl:rightOperand\": \"traceability:1.0\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"odrl:leftOperand\": \"cx-policy:UsagePurpose\",\n\t\t\t\t\t\t\t\"odrl:operator\": {\n\t\t\t\t\t\t\t\t\"@id\": \"odrl:eq\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"odrl:rightOperand\": \"cx.core.industrycore:1\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t}\n}" + "text": "{\n\t\"@context\": {\n\t\t\"odrl\": \"http://www.w3.org/ns/odrl/2/\"\n\t},\n\t\"@id\": \"test123\",\n\t\"policy\": {\n\t\t\"@type\": \"odrl:Set\",\n\t\t\"odrl:permission\": [\n\t\t\t{\n\t\t\t\t\"odrl:action\": \"use\",\n\t\t\t\t\"odrl:constraint\": {\n\t\t\t\t\t\"@type\": \"AtomicConstraint\",\n\t\t\t\t\t\"odrl:and\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"odrl:leftOperand\": \"https://w3id.org/catenax/policy/FrameworkAgreement\",\n\t\t\t\t\t\t\t\"odrl:operator\": {\n\t\t\t\t\t\t\t\t\"@id\": \"odrl:eq\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"odrl:rightOperand\": \"traceability:1.0\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"odrl:leftOperand\": \"https://w3id.org/catenax/policy/UsagePurpose\",\n\t\t\t\t\t\t\t\"odrl:operator\": {\n\t\t\t\t\t\t\t\t\"@id\": \"odrl:eq\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"odrl:rightOperand\": \"cx.core.industrycore:1\"\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t}\n}" }, "preRequestScript": "", "parameters": [],