eclipse-tractusx / item-relationship-service

https://eclipse-tractusx.github.io/item-relationship-service/docs/
Apache License 2.0
7 stars 21 forks source link

Extend the structure of how the IRS can handle Policies #249

Closed jzbmw closed 7 months ago

jzbmw commented 10 months ago

As IRS Consumer, I want to add policies the same way as EDC handles those , so that there is no structural change within the overall architecture of where the Services acts.

LOP

Hints / Details

Example:

{
    info: xy,
    ttl: xx,
    policy_use_for_use_case:[xys,ggg,ggg,]
    payload  {
        ...policy payload... as it is  
    }
}

Example:

{
  "@context": {
      "odrl": http://www.w3.org/ns/odrl/2/
  },
  "@type": "PolicyDefinitionRequestDto",
  "@id": "ap-bpn-and-up-member-trace-idtrace-up",
  "policy": {
      "@type": "Policy",
      "odrl:permission": [
          {
              "odrl:action": "USE",
              "odrl:constraint": {
                  "@type": "LogicalConstraint",
                  "odrl:and": [
                      {
                          "@type": "Constraint",
                          "odrl:leftOperand": "Membership",
                          "odrl:operator": {
                              "@id": "odrl:eq"
                          },
                          "odrl:rightOperand": "active"
                      },
                      {
                          "@type": "Constraint",
                          "odrl:leftOperand": "FrameworkAgreement.traceability",
                          "odrl:operator": {
                              "@id": "odrl:eq"
                          },
                         "odrl:rightOperand": "active"
                      },
                      {
                          "@type": "Constraint",
                          "odrl:leftOperand": "PURPOSE",
                          "odrl:operator": {
                             "@id": "odrl:eq"
                          },
                          "odrl:rightOperand": "ID 3.1 Trace"
                      }
                  ]
              }
          }
      ]
  }
} 

Outcome / Acceptance Criteria

Outcome

Out of Scope

jzbmw commented 8 months ago

built uppon json-ld

ds-psosnowski commented 7 months ago

@ds-alexander-bulgakov ready for QA

ds-alexander-bulgakov commented 7 months ago

@ds-psosnowski as already discussed could you please adjust the insomnia-collection with new JSON-body for the POST-Request? Creation and update of policy with new structure is working as expected. IRS-jobs are can be requested and are working as expected with new created policy. Tested with creation of this policy: { "validUntil": "2025-02-06T23:59:59.999Z", "payload": { "@context": { "odrl": "http://www.w3.org/ns/odrl/2/" }, "@id": "policy-test-AB_2", "policy": { "odrl:permission": [ { "odrl:action": "USE", "odrl:constraint": { "odrl:and": [ { "odrl:leftOperand": "PURPOSE", "odrl:operator": { "@id": "odrl:eq" }, "odrl:rightOperand": "ID 3.0 Trace" }, { "odrl:leftOperand": "PURPOSE", "odrl:operator": { "@id": "odrl:eq" }, "odrl:rightOperand": "ID 3.1 Trace" }, { "odrl:leftOperand": "PURPOSE", "odrl:operator": { "@id": "odrl:eq" }, "odrl:rightOperand": "R2_Traceability" }, { "odrl:leftOperand": "PURPOSE", "odrl:operator": { "@id": "odrl:eq" }, "odrl:rightOperand": "active" }, { "odrl:leftOperand": "Membership", "odrl:operator": { "@id": "odrl:eq" }, "odrl:rightOperand": "active" } ], "odrl:or": [ { "odrl:leftOperand": "Membership", "odrl:operator": { "@id": "odrl:eq" }, "odrl:rightOperand": "active" }, { "odrl:leftOperand": "PURPOSE", "odrl:operator": { "@id": "odrl:eq" }, "odrl:rightOperand": "ID 3.0 Trace" }, { "odrl:leftOperand": "PURPOSE", "odrl:operator": { "@id": "odrl:eq" }, "odrl:rightOperand": "R2_Traceability" }, { "odrl:leftOperand": "PURPOSE", "odrl:operator": { "@id": "odrl:eq" }, "odrl:rightOperand": "ID 3.1 Trace" }, { "odrl:leftOperand": "FrameworkAgreement.traceability", "odrl:operator": { "@id": "odrl:eq" }, "odrl:rightOperand": "active" } ] } } ] } } } The createdOn information for created police is not given however. Could you please check this as well? Thank you!

ds-alexander-bulgakov commented 7 months ago

Insomnia collection has been extended and previously described issue with missing createdOn has been fixed, see e.g.:

image

Ticket is done and was accepted in PO-review already.