comparison tests/policy2.ur @ 1236:d5ecceb7d1a1

Completely redid main Iflow logic; so far, policy and policy2 work
author Adam Chlipala <adamc@hcoop.net>
date Tue, 13 Apr 2010 16:30:46 -0400
parents
children
comparison
equal deleted inserted replaced
1235:a7b773f1d053 1236:d5ecceb7d1a1
1 type fruit = int
2 table fruit : { Id : fruit, Nam : string, Weight : float, Secret : string }
3 PRIMARY KEY Id,
4 CONSTRAINT Nam UNIQUE Nam
5
6 (* Everyone may knows IDs and names. *)
7 policy sendClient (SELECT fruit.Id, fruit.Nam
8 FROM fruit)
9
10 (* The weight is sensitive information; you must know the secret. *)
11 policy sendClient (SELECT fruit.Weight, fruit.Secret
12 FROM fruit
13 WHERE known(fruit.Secret))
14
15 fun main () =
16 x1 <- queryX (SELECT fruit.Id, fruit.Nam
17 FROM fruit
18 WHERE fruit.Nam = "apple")
19 (fn x => <xml><li>{[x.Fruit.Id]}: {[x.Fruit.Nam]}</li></xml>);
20 return <xml><body>
21 <ul>{x1}</ul>
22 </body></xml>