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
commit27a53b9cda6c4e3e1732659fe44a7fb6bad03655 (patch)
tree4161156186558a96b0a98dfd068d7491bb518d83 /tests/policy2.ur
parent8f4b1358953635df5066b83c250a64f28caf8190 (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>