diff options
author | Adam Chlipala <adamc@hcoop.net> | 2010-04-13 16:30:46 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2010-04-13 16:30:46 -0400 |
commit | 27a53b9cda6c4e3e1732659fe44a7fb6bad03655 (patch) | |
tree | 4161156186558a96b0a98dfd068d7491bb518d83 /tests | |
parent | 8f4b1358953635df5066b83c250a64f28caf8190 (diff) |
Completely redid main Iflow logic; so far, policy and policy2 work
Diffstat (limited to 'tests')
-rw-r--r-- | tests/policy.ur | 4 | ||||
-rw-r--r-- | tests/policy2.ur | 22 | ||||
-rw-r--r-- | tests/policy2.urp | 1 | ||||
-rw-r--r-- | tests/policy2.urs | 1 |
4 files changed, 25 insertions, 3 deletions
diff --git a/tests/policy.ur b/tests/policy.ur index 69455cd7..fedc3fcb 100644 --- a/tests/policy.ur +++ b/tests/policy.ur @@ -9,9 +9,7 @@ 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 - FROM fruit) -policy sendClient (SELECT fruit.Nam +policy sendClient (SELECT fruit.Id, fruit.Nam FROM fruit) (* The weight is sensitive information; you must know the secret. *) 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> diff --git a/tests/policy2.urp b/tests/policy2.urp new file mode 100644 index 00000000..46509756 --- /dev/null +++ b/tests/policy2.urp @@ -0,0 +1 @@ +policy2 diff --git a/tests/policy2.urs b/tests/policy2.urs new file mode 100644 index 00000000..6ac44e0b --- /dev/null +++ b/tests/policy2.urs @@ -0,0 +1 @@ +val main : unit -> transaction page |