Skip to content

fix: add binding to tx namespace for credential policy#713

Merged
wolf4ood merged 1 commit intoeclipse-tractusx:mainfrom
wolf4ood:fix/616_leftoperand
Aug 22, 2023
Merged

fix: add binding to tx namespace for credential policy#713
wolf4ood merged 1 commit intoeclipse-tractusx:mainfrom
wolf4ood:fix/616_leftoperand

Conversation

@wolf4ood
Copy link
Copy Markdown
Contributor

@wolf4ood wolf4ood commented Aug 17, 2023

WHAT

Add fix for leftOperand when using @context of odrl which get expanded with wrong namespace.

to fix this the functions are registered also in the tx namespace and the final usage will be

{
  "@context": {
    "@vocab": "https://w3id.org/edc/v0.0.1/ns/",
    "tx" : "https://w3id.org/tractusx/v0.0.1/ns/"
  },
  "@type": "PolicyDefinition",
  "@id": "{{policy-id'}}",
  "policy": {
    "@context": "http://www.w3.org/ns/odrl.jsonld",
    "permission": {
      "action": "use",
      "constraint": {
        "leftOperand": "tx:Dismantler",
        "operator": "eq",
        "rightOperand": "active"
      }
    }
  }
}

WHY

bugfix

FURTHER NOTES

In addition in order to simplify policy expressions 2 context where drafted and added in the cache:

  • tractusx
  • edc

This two for the moment are just an exploration, once we decided that they works well we can proceed to upstream the
edc one and fetch the two persistent id in https://w3id.org

Here an example on how it will look like with @context

{
  "@context": [
    "https://w3id.org/edc/v0.0.1",
    "https://w3id.org/tractusx/edc/v0.0.1",
    "http://www.w3.org/ns/odrl.jsonld"
  ],
  "@type": "PolicyDefinitionRequest",
  "@id": "${POLICY_ID}",
  "policy": {
    "@type": "Set",
    "permission": [
      {
        "action": "use",
        "constraint": [
          {
            "leftOperand": "Dismantler",
            "operator": "eq",
            "rightOperand": "active"
          }
        ]
      }
    ]
  }
}

Closes #616

@wolf4ood wolf4ood force-pushed the fix/616_leftoperand branch from f9e0acb to b511ae8 Compare August 21, 2023 13:36
@sonarqubecloud
Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@wolf4ood wolf4ood marked this pull request as ready for review August 21, 2023 15:47
@wolf4ood
Copy link
Copy Markdown
Contributor Author

\cc @yurimssilva

@wolf4ood wolf4ood merged commit 3c6acaf into eclipse-tractusx:main Aug 22, 2023
@wolf4ood wolf4ood deleted the fix/616_leftoperand branch August 22, 2023 06:39
RoseMgbii-b pushed a commit to RoseMgbii-b/tractusx-edc that referenced this pull request Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

Policy Constraint leftOperand does not match registered functions

2 participants