Mercurial > urweb
diff tests/policy.ur @ 1228:7dfa67560916
Using multiple policies to check a written value
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 11 Apr 2010 16:46:38 -0400 |
parents | 648e6b087dfb |
children | d5ecceb7d1a1 |
line wrap: on
line diff
--- a/tests/policy.ur Sun Apr 11 16:06:16 2010 -0400 +++ b/tests/policy.ur Sun Apr 11 16:46:38 2010 -0400 @@ -9,7 +9,9 @@ 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 @@ 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/>