summaryrefslogtreecommitdiff
path: root/tests/policy.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2010-04-11 16:46:38 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2010-04-11 16:46:38 -0400
commit0a67ec0c9536f5448682a491b6807e0f8d073171 (patch)
treeab00a86b3bb56cfe60755e26536437718159789f /tests/policy.ur
parent12e71069cc10ef1808a7abbd65411f0c07b5f8d1 (diff)
Using multiple policies to check a written value
Diffstat (limited to 'tests/policy.ur')
-rw-r--r--tests/policy.ur11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/policy.ur b/tests/policy.ur
index 6d4e341e..69455cd7 100644
--- a/tests/policy.ur
+++ b/tests/policy.ur
@@ -9,7 +9,9 @@ table order : { Id : order, Fruit : fruit, Qty : int, Code : int }
CONSTRAINT Fruit FOREIGN KEY Fruit REFERENCES fruit(Id)
(* Everyone may knows IDs and names. *)
-policy sendClient (SELECT fruit.Id, fruit.Nam
+policy sendClient (SELECT fruit.Id
+ FROM fruit)
+policy sendClient (SELECT fruit.Nam
FROM fruit)
(* The weight is sensitive information; you must know the secret. *)
@@ -50,11 +52,18 @@ fun main () =
AND order.Qty = 13)
(fn x => <xml><li>{[x.Fruit.Nam]}: {[x.Order.Qty]}</li></xml>);
+ ro <- oneOrNoRows (SELECT fruit.Id, fruit.Nam
+ FROM fruit);
+
return <xml><body>
<ul>{x1}</ul>
<ul>{x2}</ul>
+ {case ro of
+ None => <xml>None</xml>
+ | Some _ => <xml>Some</xml>}
+
<form>
Fruit name: <textbox{#Nam}/><br/>
Secret: <textbox{#Secret}/><br/>