diff options
| author | Jakob L. Kreuze | 2023-09-19 19:34:23 -0400 |
|---|---|---|
| committer | Jakob L. Kreuze | 2023-09-19 19:34:23 -0400 |
| commit | d04e5cb8377384f920ff9d4b689836e1dc99e152 (patch) | |
| tree | fda7060d617fdb3ef517b8ed8dcd4b197972ca68 /xacml-proofs | |
| parent | 54349f4ebcfdb0b725ce91954b63bea98b3b1f14 (diff) | |
Condition evaluation
Diffstat (limited to 'xacml-proofs')
| -rw-r--r-- | xacml-proofs/lean/Xacml.lean | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/xacml-proofs/lean/Xacml.lean b/xacml-proofs/lean/Xacml.lean index 8a7a40e..8aadefd 100644 --- a/xacml-proofs/lean/Xacml.lean +++ b/xacml-proofs/lean/Xacml.lean @@ -456,11 +456,31 @@ deriving BEq, Repr -- n.b. "The <Condition> contains one <Expression> element" structure Rule where target : Target - condition : Expression + condition : Option Expression effect : EffectType obligations : List ObligationExpression advice : List AdviceExpression +namespace Rule + def eval (rule : Rule) (context : Request) : MatchResult := + let condition := + match rule.condition with + | some condition => + -- The condition value SHALL be "True" if the <Condition> element + -- evaluates to "True". + let result := condition.eval context + if result == some (Value.primitive (#<XmlType.boolean, "True">)) then result + -- Its value SHALL be "False" if the <Condition> element evaluates to + -- "False". + else if result == some (Value.primitive (#<XmlType.boolean, "False">)) then result + -- The condition value SHALL be "Indeterminate", if the expression + -- contained in the <Condition> element evaluates to "Indeterminate." + else Value.primitive (#<XmlType.boolean, "Indeterminate">) + -- The condition value SHALL be "True" if the <Condition> element is absent. + | none => Value.primitive (#<XmlType.boolean, "True">) + sorry +end Rule + structure PolicySet where combinator : CombinatorAlgorithm target : Target |