-
Notifications
You must be signed in to change notification settings - Fork 23
Custom operation events
joshua-roberts edited this page Aug 27, 2024
·
1 revision
Custom operations behave the same as default admin operations in the EPP. Custom operations have a set of operands and a subset of them are node operands which can be used to define patterns in obligation event patterns.
Operation:
operation op1(nodeop string a, string b) {
create object "o1" in [a]
}
Obligation using operation:
create obligation "obl1" {
create rule "r1"
when any user
performs "op1"
on {
"a": ["oa1", "oa2"] // matches if operand a is "oa1" or "oa2"
"b": "test" // IGNORED, since operand b is not a node operand
}
do(ctx) {
/*
access all operands (not just node operands) of operation "op1":
ctx.operands.a
ctx.operands.b
*/
}
}
Adjudicate the custom admin operation
EPP epp = new EPP(pdp, pap);
pdp.adjudicateAdminOperations(new UserContext("u1"), List.of(
new OperationRequest("op1", Map.of("a", "oa1", "b", "test"))
));