Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Aug 22, 2023

Conversation

wolf4ood
Copy link
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

@sonarcloud
Copy link

sonarcloud bot commented Aug 21, 2023

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
Contributor Author

\cc @yurimssilva

@wolf4ood wolf4ood merged commit 3c6acaf into eclipse-tractusx:main Aug 22, 2023
23 checks passed
@wolf4ood wolf4ood deleted the fix/616_leftoperand branch August 22, 2023 06:39
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