summaryrefslogtreecommitdiff
path: root/tests/policy2.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2010-04-13 16:30:46 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2010-04-13 16:30:46 -0400
commitc4f4ed6ee7f6fe49d19ca68b9fff6735b8a86fec (patch)
tree4161156186558a96b0a98dfd068d7491bb518d83 /tests/policy2.ur
parentc77a8eb70eec73d741eccdf2c0705b28db847a92 (diff)
Completely redid main Iflow logic; so far, policy and policy2 work
Diffstat (limited to 'tests/policy2.ur')
-rw-r--r--tests/policy2.ur22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/policy2.ur b/tests/policy2.ur
new file mode 100644
index 00000000..b8480c0c
--- /dev/null
+++ b/tests/policy2.ur
@@ -0,0 +1,22 @@
+type fruit = int
+table fruit : { Id : fruit, Nam : string, Weight : float, Secret : string }
+ PRIMARY KEY Id,
+ CONSTRAINT Nam UNIQUE Nam
+
+(* Everyone may knows IDs and names. *)
+policy sendClient (SELECT fruit.Id, fruit.Nam
+ FROM fruit)
+
+(* The weight is sensitive information; you must know the secret. *)
+policy sendClient (SELECT fruit.Weight, fruit.Secret
+ FROM fruit
+ WHERE known(fruit.Secret))
+
+fun main () =
+ x1 <- queryX (SELECT fruit.Id, fruit.Nam
+ FROM fruit
+ WHERE fruit.Nam = "apple")
+ (fn x => <xml><li>{[x.Fruit.Id]}: {[x.Fruit.Nam]}</li></xml>);
+ return <xml><body>
+ <ul>{x1}</ul>
+ </body></xml>