Skip to content

Commit

Permalink
Merge pull request #852 from dsmf/chore/fix-old-constraint-prefix
Browse files Browse the repository at this point in the history
Chore/fix old constraint prefix
  • Loading branch information
ds-jhartmann authored Jul 25, 2024
2 parents 2cc9767 + 958014b commit 1fcdce7
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 37 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
- Change policy to include full namespace `https://w3id.org/catenax/policy/` instead of `cx-policy:`
in some remaining code places (in context of #794).

### Changed

Expand Down
3 changes: 2 additions & 1 deletion charts/item-relationship-service/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Change default policy to include full namespace `https://w3id.org/catenax/policy/` instead of `cx-policy:`
- Change default policy to include full namespace `https://w3id.org/catenax/policy/` instead of `cx-policy:`
(in context of #794).

## [7.3.0] - 2024-07-15

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions local/testing/request-collection/IRS_Request_Collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand Down Expand Up @@ -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": [],
Expand Down

0 comments on commit 1fcdce7

Please sign in to comment.