Commit 9dbe5b04 authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Put all arguments of Web_election.make in a record

parent a75e9b72
...@@ -142,12 +142,10 @@ let process_datadir dir = ...@@ -142,12 +142,10 @@ let process_datadir dir =
) )
in in
let featured = item.datadir_featured in let featured = item.datadir_featured in
let election = Web_election.make let election = Web_election.(make {
raw_election metadata raw_election; metadata; featured;
~featured params_fname; public_keys_fname;
~params_fname }) in
~public_keys_fname
in
let module X = (val election : WEB_ELECTION) in let module X = (val election : WEB_ELECTION) in
X.B.inject_creds public_creds >> X.B.inject_creds public_creds >>
return election return election
......
...@@ -28,6 +28,14 @@ open Serializable_t ...@@ -28,6 +28,14 @@ open Serializable_t
open Web_serializable_t open Web_serializable_t
open Web_common open Web_common
type config = {
raw_election : string;
metadata : metadata;
featured : bool;
params_fname : string;
public_keys_fname : string;
}
let can_read m user = let can_read m user =
match m.e_readers with match m.e_readers with
| None -> false | None -> false
...@@ -44,7 +52,7 @@ let can_vote m user = ...@@ -44,7 +52,7 @@ let can_vote m user =
| None -> false (* voters must log in *) | None -> false (* voters must log in *)
| Some u -> check_acl (Some acls) u.user_user | Some u -> check_acl (Some acls) u.user_user
let make raw_election metadata ~featured ~params_fname ~public_keys_fname = let make {raw_election; metadata; featured; params_fname; public_keys_fname} =
let e_fingerprint = sha256_b64 raw_election in let e_fingerprint = sha256_b64 raw_election in
let wrapped_params = Serializable_j.params_of_string let wrapped_params = Serializable_j.params_of_string
......
...@@ -24,10 +24,12 @@ open Serializable_t ...@@ -24,10 +24,12 @@ open Serializable_t
open Web_serializable_t open Web_serializable_t
open Web_signatures open Web_signatures
val make : type config = {
string -> raw_election : string;
metadata -> metadata : metadata;
featured:bool -> featured : bool;
params_fname:string -> params_fname : string;
public_keys_fname:string -> public_keys_fname : string;
(module WEB_ELECTION) }
val make : config -> (module WEB_ELECTION)
Supports Markdown
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