Commit f5444218 authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Do not put "cas:" in front of CAS users

parent 794f02e4
...@@ -310,12 +310,11 @@ let do_cast election uuid () = ...@@ -310,12 +310,11 @@ let do_cast election uuid () =
let open Web_common in let open Web_common in
let module X = (val election : WEB_ELECTION) in let module X = (val election : WEB_ELECTION) in
match_lwt Eliom_reference.get Services.user with match_lwt Eliom_reference.get Services.user with
| Some {user_type; user_name} as u -> | Some user as u ->
lwt b = check_acl can_vote X.data u in lwt b = check_acl can_vote X.data u in
if b then ( if b then (
let t = string_of_user_type user_type in
let record = let record =
Printf.sprintf "%s:%s" t user_name, Web_common.string_of_user user,
(CalendarLib.Fcalendar.Precise.now (), None) (CalendarLib.Fcalendar.Precise.now (), None)
in in
lwt result = lwt result =
......
...@@ -8,9 +8,7 @@ let site_title = "Election Server" ...@@ -8,9 +8,7 @@ let site_title = "Election Server"
let welcome_message = "Welcome!" let welcome_message = "Welcome!"
let format_user u = let format_user u =
let open Web_common in pcdata (Web_common.string_of_user u)
let t = string_of_user_type u.user_type in
Printf.ksprintf pcdata "%s:%s" t u.user_name
let base ~title ~content = let base ~title ~content =
lwt user = Eliom_reference.get Services.user in lwt user = Eliom_reference.get Services.user in
......
...@@ -4,15 +4,16 @@ open Serializable_t ...@@ -4,15 +4,16 @@ open Serializable_t
type user_type = Dummy | CAS type user_type = Dummy | CAS
let string_of_user_type = function
| Dummy -> "dummy"
| CAS -> "cas"
type user = { type user = {
user_name : string; user_name : string;
user_type : user_type; user_type : user_type;
} }
let string_of_user {user_name; user_type} =
match user_type with
| Dummy -> Printf.sprintf "dummy:%s" user_name
| CAS -> user_name
type acl = type acl =
| Any | Any
| Restricted of (user -> bool Lwt.t) | Restricted of (user -> bool Lwt.t)
......
...@@ -2,13 +2,13 @@ open Serializable_t ...@@ -2,13 +2,13 @@ open Serializable_t
type user_type = Dummy | CAS type user_type = Dummy | CAS
val string_of_user_type : user_type -> string
type user = { type user = {
user_name : string; user_name : string;
user_type : user_type; user_type : user_type;
} }
val string_of_user : user -> string
type acl = type acl =
| Any | Any
| Restricted of (user -> bool Lwt.t) | Restricted of (user -> bool Lwt.t)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment