Policies¶
This is a collection of Policies that can be used in the Dataspace.
There exists also a repository to get familiar with creating policies, see EdcPolicyPlayground.
Blank Policy¶
A policy that has no conditions.
{
"@type": "odrl:Set",
"odrl:permission": [
{
"odrl:action": "USE"
}
]
}
BPN Policy¶
A policy that requires to have a specific BPN (unique ID for Connectors in the Dataspace).
bpn = "..."
{
"@type": "odrl:Set",
"odrl:permission": [
{
"odrl:action": "USE",
"odrl:constraint": {
"odrl:or": [
{
"odrl:leftOperand": "BusinessPartnerNumber",
"odrl:operator": {
"@id": "odrl:eq"
},
"odrl:rightOperand": bpn
}
]
}
}
]
}
Time Interval Policy¶
A policy the requires the current time for the transfer to be in a certain interval.
Note: You will need to add "xsd": "http://www.w3.org/2001/XMLSchema#" to @context.
time_from = "2023-01-01T00:00:01Z"
time_to = "2026-01-01T00:00:01Z"
{
"@type": "odrl:Set",
"odrl:permission": [
{
"odrl:action": "USE",
"odrl:constraint": [
{
"odrl:and": [
{
"odrl:leftOperand": "https://w3id.org/edc/v0.0.1/ns/inForceDate",
"odrl:operator": {
"@id": "odrl:gteq"
},
"odrl:rightOperand": {
"@value": time_from,
"@type": "xsd:datetime"
}
},
{
"odrl:leftOperand": "https://w3id.org/edc/v0.0.1/ns/inForceDate",
"odrl:operator": {
"@id": "odrl:lteq"
},
"odrl:rightOperand": {
"@value": time_to,
"@type": "xsd:datetime"
}
}
]
}
]
}
]
}
Time Duration Policy¶
A policy the requires the current time for the transfer to be within up to a certain time of the generation of an Agreement.
duration = "1d"
{
"@type": "odrl:Set",
"odrl:permission": [
{
"odrl:action": "USE",
"odrl:constraint": [
{
"odrl:and": [
{
"odrl:leftOperand": "https://w3id.org/edc/v0.0.1/ns/inForceDate",
"odrl:operator": {
"@id": "odrl:gteq"
},
"odrl:rightOperand": {
"@value": "contractAgreement+0s",
"@type": "dateExpression"
}
},
{
"odrl:leftOperand": "https://w3id.org/edc/v0.0.1/ns/inForceDate",
"odrl:operator": {
"@id": "odrl:lteq"
},
"odrl:rightOperand": {
"@value": f"contractAgreement+{duration}",
"@type": "dateExpression"
}
}
]
}
]
}
]
}
BPN Group Policy¶
A policy that requires to be part of a specific BPN group.
group = "..."
{
"@type": "odrl:Set",
"odrl:permission": [
{
"odrl:action": "USE",
"odrl:constraint": [
{
"odrl:leftOperand": "https://w3id.org/tractusx/v0.0.1/ns/BusinessPartnerGroup",
"odrl:operator": {
"@id": "odrl:isPartOf"
},
"odrl:rightOperand": group
}
]
}
]
}
A BPN can be added to a BPN group by sending a POST request with the following payload to /management/business-partner-groups. The group does not need to be created separately first.
group = "..."
bpn = "..."
{
"@context": {
"tx": "https://w3id.org/tractusx/v0.0.1/ns/"
},
"@id": bpn,
"tx:groups": [
group
]
}
Credential Policy¶
A policy that requires to hold a specific Credential.
credential = "..."
{
"@type": "odrl:Set",
"odrl:permission": [
{
"odrl:action": "USE",
"odrl:constraint": {
"odrl:or": [
{
"odrl:leftOperand": credential,
"odrl:operator": {
"@id": "odrl:eq"
},
"odrl:rightOperand": "active"
}
]
}
}
]
}