Commit 6b6298f3 authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Add Services.election_public_keys

parent 071f86a0
......@@ -22,6 +22,7 @@ type election_data = {
fingerprint : string;
election : ff_pubkey election;
public_keys : Z.t trustee_public_key array;
public_keys_file : string;
election_result : Z.t result option;
author : user;
featured_p : bool;
......@@ -68,8 +69,9 @@ let load_elections_and_votes dirname =
Serializable_j.read_ff_pubkey raw
in
(assert_lwt (Uuidm.equal uuid election.e_uuid)) >>
let public_keys_file = data "public_keys.jsons" in
lwt public_keys =
data "public_keys.jsons" |>
public_keys_file |>
Lwt_io.lines_of_file |>
Lwt_stream.map (fun x ->
Serializable_j.trustee_public_key_of_string Serializable_builtin_j.read_number x
......@@ -99,6 +101,7 @@ let load_elections_and_votes dirname =
fingerprint;
election;
public_keys;
public_keys_file;
election_result;
author = { user_name = "admin"; user_type = Dummy };
featured_p = true;
......
......@@ -18,6 +18,7 @@ type election_data = {
fingerprint : string;
election : ff_pubkey election;
public_keys : Z.t trustee_public_key array;
public_keys_file : string;
election_result : Z.t result option;
author : user;
featured_p : bool;
......
......@@ -185,6 +185,15 @@ let () = Eliom_registration.String.register
)
)
let () = Eliom_registration.File.register
~service:Services.election_public_keys
~content_type:"application/json"
(if_eligible can_read
(fun uuid election user () ->
return election.Common.public_keys_file
)
)
let () = Eliom_registration.String.register
~service:Services.election_ballots
(if_eligible can_read
......
......@@ -79,6 +79,11 @@ let election_raw = service
~get_params:uuid
()
let election_public_keys = service
~path:["election"; "public_keys"]
~get_params:uuid
()
let election_vote = service
~path:["election"; "vote"]
~get_params:uuid
......
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