Commit 2e80497e authored by Stephane Glondu's avatar Stephane Glondu

Move call to Auth.configure and simplify structure of Web_election

parent 6cde86d2
......@@ -32,18 +32,13 @@ open Web_services
let ( / ) = Filename.concat
module type REGISTRATION = sig
module W : WEB_ELECTION
module Register (X : EMPTY) : EMPTY
end
module type REGISTRABLE = sig
module W : sig
include ELECTION_DATA
include WEB_PARAMS
module E : ELECTION with type elt = G.t
end
module Register (X : EMPTY) : REGISTRATION
module Register (X : EMPTY) : WEB_ELECTION
end
module Make (D : ELECTION_DATA) (P : WEB_PARAMS) : REGISTRABLE = struct
......@@ -55,7 +50,7 @@ module Make (D : ELECTION_DATA) (P : WEB_PARAMS) : REGISTRABLE = struct
module E = Election.MakeElection(G)(M)
end
module Register (X : EMPTY) : REGISTRATION = struct
module Register (X : EMPTY) : WEB_ELECTION = struct
let uuid = Uuidm.to_string D.election.e_params.e_uuid
let base_path = ["elections"; uuid]
......@@ -72,8 +67,8 @@ module Make (D : ELECTION_DATA) (P : WEB_PARAMS) : REGISTRABLE = struct
end
module Auth = Web_auth.Make (N)
let () = Auth.configure N.auth_config
module W = struct
include W
module B : WEB_BALLOT_BOX = struct
......@@ -254,17 +249,6 @@ module Make (D : ELECTION_DATA) (P : WEB_PARAMS) : REGISTRABLE = struct
end
module Auth = Auth
end
module Register (X : EMPTY) : EMPTY = struct
let () =
Auth.configure N.auth_config
end
end
end
......@@ -25,18 +25,13 @@ open Signatures
open Web_serializable_t
open Web_signatures
module type REGISTRATION = sig
module W : WEB_ELECTION
module Register (X : EMPTY) : EMPTY
end
module type REGISTRABLE = sig
module W : sig
include ELECTION_DATA
include WEB_PARAMS
module E : ELECTION with type elt = G.t
end
module Register (X : EMPTY) : REGISTRATION
module Register (X : EMPTY) : WEB_ELECTION
end
module Make (D : ELECTION_DATA) (P : WEB_PARAMS) : REGISTRABLE
......@@ -91,9 +91,7 @@ let register_election params web_params =
let module R = Web_election.Make (D) (P) in
(module R : Web_election.REGISTRABLE), fun () ->
(* starting from here, we do side-effects on the running server *)
let module R = R.Register (struct end) in
let module W = R.W in
let module X : EMPTY = R.Register (T) in
let module W = R.Register (struct end) in
let election = (module W : WEB_ELECTION) in
election_table := SMap.add uuid election !election_table;
election
......
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