Skip to content

Commit a03b350

Browse files
committed
fix comments
1 parent b321a11 commit a03b350

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

policy-extension/src/main/java/org/eclipse/edc/extension/possiblepolicy/NegotiationContractExpiryCheckFunction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public boolean evaluate(Operator operator, Object rightValue, R rule, PolicyCont
9393
}
9494

9595
context.reportProblem(format("Unsupported right-value, expected either an ISO-8061 String or a expression matching '%s', but got '%s'",
96-
ContractExpiryCheckFunction.CONTRACT_EXPIRY_EVALUATION_KEY, rightValueStr));
96+
EXPRESSION_REGEX, rightValueStr));
9797
} catch (NullPointerException | DateTimeParseException ex) {
9898
monitor.warning(format("Exception during time policy evaluation: %s %s", ex.getClass().getCanonicalName(), ex.getMessage()));
9999
context.reportProblem(ex.getMessage());

policy-extension/src/main/java/org/eclipse/edc/extension/possiblepolicy/PossiblePolicyExtension.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.eclipse.edc.spi.system.ServiceExtension;
2626
import org.eclipse.edc.spi.system.ServiceExtensionContext;
2727

28+
import static org.eclipse.edc.connector.contract.spi.validation.ContractValidationService.TRANSFER_SCOPE;
2829
import static org.eclipse.edc.policy.model.OdrlNamespace.ODRL_SCHEMA;
2930

3031
import java.util.Map;
@@ -57,18 +58,28 @@ public String name() {
5758
public void initialize(ServiceExtensionContext context) {
5859
var monitor = context.getMonitor();
5960

60-
// register use action for both negotiation and transfer scope
61+
// register use action for both negotiation scope
6162
ruleBindingRegistry.bind("use", NEGOTIATION_SCOPE);
6263
ruleBindingRegistry.bind("USE", NEGOTIATION_SCOPE);
6364
ruleBindingRegistry.bind(ODRL_SCHEMA + "use", NEGOTIATION_SCOPE);
6465

65-
// iterate over claim constraint key map and register functions for negotiation and transfer scope
66+
ruleBindingRegistry.bind("use", TRANSFER_SCOPE);
67+
ruleBindingRegistry.bind("USE", TRANSFER_SCOPE);
68+
ruleBindingRegistry.bind(ODRL_SCHEMA + "use", TRANSFER_SCOPE);
69+
70+
// iterate over claim constraint key map and register functions for negotiation scope
6671
for (Map.Entry<String, String> entry : CONSTRAINT_KEY_MAP.entrySet()) {
6772
ruleBindingRegistry.bind(entry.getKey(), NEGOTIATION_SCOPE);
6873
policyEngine.registerFunction(NEGOTIATION_SCOPE, Permission.class, entry.getKey(),
6974
new ClientClaimConstraintFunction<>(monitor, entry.getValue(), VERBOSE));
7075
policyEngine.registerFunction(NEGOTIATION_SCOPE, Prohibition.class, entry.getKey(),
7176
new ClientClaimConstraintFunction<>(monitor, entry.getValue(), VERBOSE));
77+
78+
ruleBindingRegistry.bind(entry.getKey(), TRANSFER_SCOPE);
79+
policyEngine.registerFunction(TRANSFER_SCOPE, Permission.class, entry.getKey(),
80+
new ClientClaimConstraintFunction<>(monitor, entry.getValue(), VERBOSE));
81+
policyEngine.registerFunction(TRANSFER_SCOPE, Prohibition.class, entry.getKey(),
82+
new ClientClaimConstraintFunction<>(monitor, entry.getValue(), VERBOSE));
7283
}
7384

7485
// also register reimplementation of standard edc contract expiry check function for negotiation scope

0 commit comments

Comments
 (0)