feat: adds REST API for policy evaluation plan #4452
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR changes/adds
introduces an alpha REST API for policy evaluation plan.
Why it does that
Improve policies management and debuggability
Further notes
For example given this policy in MVD:
policy example
{ "@id": "require-membership", "@type": "PolicyDefinition", "createdAt": 1725466366896, "policy": { "@id": "51d3c610-b141-4269-a4c0-df2a77122cfe", "@type": "odrl:Set", "odrl:permission": { "odrl:action": { "@id": "use" }, "odrl:constraint": { "odrl:leftOperand": { "@id": "MembershipCredential" }, "odrl:operator": { "@id": "odrl:eq" }, "odrl:rightOperand": "active" } }, "odrl:prohibition": [], "odrl:obligation": [] }, "@context": { "@vocab": "https://w3id.org/edc/v0.0.1/ns/", "edc": "https://w3id.org/edc/v0.0.1/ns/", "odrl": "http://www.w3.org/ns/odrl/2/" } },An evaluation plan output within the
catalogscope will look like this:evaluation plan in catalog scope
{ "@type": "PolicyEvaluationPlan", "preValidators": [], "permissionSteps": { "@type": "PermissionStep", "isFiltered": false, "filteringReasons": [], "ruleFunctionSteps": "ExamplePermissionFunction", "constraintSteps": { "@type": "AtomicConstraintStep", "isFiltered": false, "filteringReasons": [], "functionName": "MembershipCredentialEvaluationFunction", "functionParams": [ "'MembershipCredential'", "EQ", "'active'" ] }, "dutySteps": [] }, "prohibitionSteps": [], "obligationSteps": [], "postValidators": [], "@context": { "@vocab": "https://w3id.org/edc/v0.0.1/ns/", "edc": "https://w3id.org/edc/v0.0.1/ns/", "odrl": "http://www.w3.org/ns/odrl/2/" } }while in the
request.catalogscope will look like this:evaluation plan in catalog scope
{ "@type": "PolicyEvaluationPlan", "preValidators": "DcpScopeExtractorFunction", "permissionSteps": { "@type": "PermissionStep", "isFiltered": false, "filteringReasons": [], "ruleFunctionSteps": [], "constraintSteps": { "@type": "AtomicConstraintStep", "isFiltered": true, "filteringReasons": [ "leftOperand 'MembershipCredential' is not bound to scope 'request.catalog'", "leftOperand 'MembershipCredential' is not bound to any function within scope 'request.catalog'" ], "functionParams": [ "'MembershipCredential'", "EQ", "'active'" ] }, "dutySteps": [] }, "prohibitionSteps": [], "obligationSteps": [], "postValidators": "DefaultScopeMappingFunction", "@context": { "@vocab": "https://w3id.org/edc/v0.0.1/ns/", "edc": "https://w3id.org/edc/v0.0.1/ns/", "odrl": "http://www.w3.org/ns/odrl/2/" } }Linked Issue(s)
Closes #4447