summaryrefslogtreecommitdiff
path: root/forum/author.urs
diff options
context:
space:
mode:
Diffstat (limited to 'forum/author.urs')
-rw-r--r--forum/author.urs52
1 files changed, 43 insertions, 9 deletions
diff --git a/forum/author.urs b/forum/author.urs
index 619aced..1f394f0 100644
--- a/forum/author.urs
+++ b/forum/author.urs
@@ -1,17 +1,51 @@
-type author
+(********************************** A user ***********************************)
-val anonymous : author
-val namedAuthor : string -> author
+type usernameOrAnonymous
-(********************************* Instances *********************************)
+(*** Instances **)
-val eq_author : eq author
+val eq_usernameOrAnonymous : eq usernameOrAnonymous
-val show_author : show author
+val show_usernameOrAnonymous : show usernameOrAnonymous
-(* 'read' producing an 'author' is guaranteed to never fail, so you can use
+(* 'read' producing a 'usernameOrAnonymous' is guaranteed to never fail, so you
+can use 'readError' with impunity. *)
+val read_usernameOrAnonymous : read usernameOrAnonymous
+
+val sql_usernameOrAnonymous : sql_injectable usernameOrAnonymous
+
+
+(*** Getting the username ***)
+
+(* Grabs username out of MIT certificate. *)
+val current : transaction usernameOrAnonymous
+
+
+(******************************* A named user ********************************)
+
+type username
+
+
+(*** Instances **)
+
+val eq_username : eq username
+
+val show_username : show username
+
+(* 'read' producing a 'username' is guaranteed to never fail, so you can use
'readError' with impunity. *)
-val read_author : read author
+val read_username : read username
+
+val sql_username : sql_injectable username
+
+
+(******************************** Converting *********************************)
+
+val name : usernameOrAnonymous -> option username
+
+val orAnonymous : username -> usernameOrAnonymous
-val sql_author : sql_injectable author
+(* Converts a 'usernameOrAnonymous' to an 'option' tag. If anonymous, produces
+empty XML. *)
+val toOptionTag : use ::: {Type} -> usernameOrAnonymous -> xml select use []