Skip to content

Commit 44f6729

Browse files
ortegindr-brt
andauthored
fix(policy/enforcement): update README for policy 01 (#416)
* fix policy-01-policy-enforcement/README.md * Update policy/policy-01-policy-enforcement/README.md * Update policy/policy-01-policy-enforcement/README.md Co-authored-by: andrea bertagnolli <andrea.bertagnolli@gmail.com> * Update policy/policy-01-policy-enforcement/README.md Co-authored-by: andrea bertagnolli <andrea.bertagnolli@gmail.com> * delete unnecessary imports --------- Co-authored-by: andrea bertagnolli <andrea.bertagnolli@gmail.com>
1 parent edc5404 commit 44f6729

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

policy/policy-01-policy-enforcement/README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,15 @@ to the negotiation scope anymore, the negotiation will be terminated. When recei
400400
the provider will still evaluate its contract definitions' access policies using the catalog scope, to ensure that
401401
a consumer cannot negotiate an offer it is not allowed to see.
402402

403+
404+
```java
405+
ruleBindingRegistry.bind(LOCATION_CONSTRAINT_KEY, CATALOG_SCOPE);
406+
policyEngine.registerFunction(CatalogPolicyContext.class, Permission.class, LOCATION_CONSTRAINT_KEY, new LocationConstraintFunction(monitor));
407+
```
408+
409+
Let's change ContractNegotiationPolicyContext with CatalogPolicyContext in LocationConstraintFunction.java
410+
403411
```java
404-
ruleBindingRegistry.bind(LOCATION_CONSTRAINT_KEY, CATALOGING_SCOPE);
405-
policyEngine.registerFunction(CATALOGING_SCOPE, Permission.class, LOCATION_CONSTRAINT_KEY, new LocationConstraintFunction(monitor));
412+
public class LocationConstraintFunction implements AtomicConstraintRuleFunction<Permission, CatalogPolicyContext>
413+
public boolean evaluate(Operator operator, Object rightValue, Permission rule, CatalogPolicyContext context)
406414
```

0 commit comments

Comments
 (0)