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

Add is_admin to access the record list

parent f5444218
......@@ -257,7 +257,7 @@ let () = Eliom_registration.Streamlist.register
~service:Services.election_records
(if_eligible can_read
(fun uuid election user () ->
forbidden () >> (* FIXME *)
if Web_common.is_admin user then (
let module X = (val election : Web_common.WEB_ELECTION) in
(* TODO: streaming *)
lwt ballots = X.B.fold_records (fun (u, d) xs ->
......@@ -269,6 +269,7 @@ let () = Eliom_registration.Streamlist.register
return (Ocsigen_stream.of_string b)
) ballots in
return (s, "text/plain")
) else forbidden ()
)
)
......
......@@ -14,6 +14,11 @@ let string_of_user {user_name; user_type} =
| Dummy -> Printf.sprintf "dummy:%s" user_name
| CAS -> user_name
(* FIXME: use a dedicated user_type *)
let is_admin = function
| Some { user_name = "admin"; user_type = Dummy } -> true
| _ -> false
type acl =
| Any
| Restricted of (user -> bool Lwt.t)
......
......@@ -8,6 +8,7 @@ type user = {
}
val string_of_user : user -> string
val is_admin : user option -> bool
type acl =
| Any
......
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