Commit c906c565 authored by Stephane Glondu's avatar Stephane Glondu

Templates don't need groups

parent cad131a8
......@@ -61,12 +61,12 @@ let raw_find_election uuid =
let%lwt raw_election = Web_persist.get_raw_election uuid in
match raw_election with
| Some raw_election ->
return Election.(get_group (of_string raw_election))
return (Election.of_string raw_election)
| _ -> Lwt.fail Not_found
module WCacheTypes = struct
type key = uuid
type value = (module ELECTION_DATA)
type value = Yojson.Safe.json election
end
module WCache = Ocsigen_cache.Make (WCacheTypes)
......@@ -570,13 +570,12 @@ let () =
Any.register ~service:election_regenpwd_post
(fun (uuid, ()) user ->
with_site_user (fun u ->
let%lwt w = find_election uuid in
let%lwt election = find_election uuid in
let%lwt metadata = Web_persist.get_election_metadata uuid in
let module W = (val w) in
if metadata.e_owner = Some u then (
let table = "password_" ^ underscorize uuid in
let table = Ocsipersist.open_table table in
let title = W.election.e_params.e_name in
let title = election.e_params.e_name in
let url = Eliom_uri.make_string_uri
~absolute:true ~service:election_home
(uuid, ()) |> rewrite_prefix
......@@ -1170,9 +1169,9 @@ let () =
Any.register ~service:election_update_credential_post
(fun (uuid, ()) (old, new_) ->
with_site_user (fun u ->
let%lwt w = find_election uuid in
let%lwt election = find_election uuid in
let%lwt metadata = Web_persist.get_election_metadata uuid in
let module W = (val w) in
let module W = (val Election.get_group election) in
let module WE = Web_election.Make (W) (LwtRandom) in
if metadata.e_owner = Some u then (
try%lwt
......@@ -1222,8 +1221,8 @@ let () =
let () =
Any.register ~service:election_cast_confirm
(fun (uuid, ()) () ->
let%lwt w = find_election uuid in
let module W = (val w) in
let%lwt election = find_election uuid in
let module W = (val Election.get_group election) in
let module WE = Web_election.Make (W) (LwtRandom) in
match%lwt Eliom_reference.get Web_state.ballot with
| Some the_ballot ->
......@@ -1363,8 +1362,8 @@ let () =
let%lwt () =
if trustee_id > 0 then return () else fail_http 404
in
let%lwt w = find_election uuid in
let module W = (val w) in
let%lwt election = find_election uuid in
let module W = (val Election.get_group election) in
let module E = Election.MakeElection (W.G) (LwtRandom) in
let%lwt pks =
match%lwt Web_persist.get_threshold uuid with
......@@ -1400,9 +1399,9 @@ let () =
let handle_election_tally_release (uuid, ()) () =
with_site_user (fun u ->
let uuid_s = raw_string_of_uuid uuid in
let%lwt w = find_election uuid in
let%lwt election = find_election uuid in
let%lwt metadata = Web_persist.get_election_metadata uuid in
let module W = (val w) in
let module W = (val Election.get_group election) in
let module E = Election.MakeElection (W.G) (LwtRandom) in
if metadata.e_owner = Some u then (
let%lwt npks, ntallied =
......@@ -1503,9 +1502,9 @@ let () =
Any.register ~service:election_compute_encrypted_tally
(fun (uuid, ()) () ->
with_site_user (fun u ->
let%lwt w = find_election uuid in
let%lwt election = find_election uuid in
let%lwt metadata = Web_persist.get_election_metadata uuid in
let module W = (val w) in
let module W = (val Election.get_group election) in
let module WE = Web_election.Make (W) (LwtRandom) in
if metadata.e_owner = Some u then (
let%lwt () =
......
This diff is collapsed.
......@@ -23,7 +23,7 @@ open Serializable_t
open Web_serializable_t
open Signatures
val admin : elections:((module ELECTION_DATA) list * (module ELECTION_DATA) list * (module ELECTION_DATA) list * (uuid * string) list) option -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val admin : elections:('a election list * 'a election list * 'a election list * (uuid * string) list) option -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val new_election_failure : [ `Exists | `Exception of exn ] -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
......@@ -46,21 +46,21 @@ val election_setup_trustees : uuid -> setup_election -> unit -> [> `Html ] Eliom
val election_setup_threshold_trustees : uuid -> setup_election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_trustee : string -> uuid -> setup_election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_threshold_trustee : string -> uuid -> setup_election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_import : uuid -> setup_election -> (module ELECTION_DATA) list * (module ELECTION_DATA) list * (module ELECTION_DATA) list -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_import_trustees : uuid -> setup_election -> (module ELECTION_DATA) list * (module ELECTION_DATA) list * (module ELECTION_DATA) list -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_import : uuid -> setup_election -> 'a election list * 'a election list * 'a election list -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_import_trustees : uuid -> setup_election -> 'a election list * 'a election list * 'a election list -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_confirm : uuid -> setup_election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_home : (module ELECTION_DATA) -> Web_persist.election_state -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_admin : (module ELECTION_DATA) -> Web_serializable_j.metadata -> Web_persist.election_state -> (unit -> string list Lwt.t) -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val update_credential : (module ELECTION_DATA) -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_home : 'a election -> Web_persist.election_state -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_admin : 'a election -> Web_serializable_j.metadata -> Web_persist.election_state -> (unit -> string list Lwt.t) -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val update_credential : 'a election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val regenpwd : uuid -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val cast_raw : (module ELECTION_DATA) -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val cast_confirmation : (module ELECTION_DATA) -> string -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val cast_confirmed : (module ELECTION_DATA) -> result:[< `Error of Web_common.error | `Valid of string ] -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val pretty_ballots : (module ELECTION_DATA) -> string list -> Yojson.Safe.json result option -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val pretty_records : (module ELECTION_DATA) -> (string * string) list -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val cast_raw : 'a election -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val cast_confirmation : 'a election -> string -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val cast_confirmed : 'a election -> result:[< `Error of Web_common.error | `Valid of string ] -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val pretty_ballots : 'a election -> string list -> Yojson.Safe.json result option -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val pretty_records : 'a election -> (string * string) list -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val tally_trustees : (module ELECTION_DATA) -> int -> string -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val tally_trustees : 'a election -> int -> string -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val already_logged_in :
unit -> [> `Html ] Eliom_content.Html5.F.elt 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