Maj terminée. Pour consulter la release notes associée voici le lien :
https://about.gitlab.com/releases/2021/07/07/critical-security-release-gitlab-14-0-4-released/

Une nouvelle version du portail de gestion des comptes externes sera mise en production lundi 09 août. Elle permettra d'allonger la validité d'un compte externe jusqu'à 3 ans. Pour plus de détails sur cette version consulter : https://doc-si.inria.fr/x/FCeS

Commit 5f7a82bc authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Rename "election" datatype into "params" where appropriate

parent bdf40f94
...@@ -32,7 +32,7 @@ let y = KG.combine public_keys;; ...@@ -32,7 +32,7 @@ let y = KG.combine public_keys;;
(* Setup election *) (* Setup election *)
let election = { let params = {
e_description = "This is a test election."; e_description = "This is a test election.";
e_name = "Test election"; e_name = "Test election";
e_public_key = y; e_public_key = y;
...@@ -73,14 +73,14 @@ let metadata = ...@@ -73,14 +73,14 @@ let metadata =
module P = struct module P = struct
module G = G module G = G
let params = election let params = params
let metadata = Some metadata let metadata = Some metadata
let public_keys = Lazy.lazy_from_val ( let public_keys = Lazy.lazy_from_val (
public_keys |> Array.map (fun x -> x.trustee_public_key) public_keys |> Array.map (fun x -> x.trustee_public_key)
) )
let fingerprint = let fingerprint =
election |> params |>
Serializable_j.string_of_election Serializable_builtin_j.write_number |> Serializable_j.string_of_params Serializable_builtin_j.write_number |>
hashB hashB
end;; end;;
...@@ -145,15 +145,15 @@ let list_save_to filename writer xs = ...@@ -145,15 +145,15 @@ let list_save_to filename writer xs =
close_out oc;; close_out oc;;
let save_to_disk () = let save_to_disk () =
let election = { election with let params = { params with
e_public_key = G.({ g; p; q; y }) e_public_key = G.({ g; p; q; y })
} in } in
let ballots = Array.of_list (M.fold_ballots (fun x xs () -> x::xs) [] ()) in let ballots = Array.of_list (M.fold_ballots (fun x xs () -> x::xs) [] ()) in
let dir = Printf.sprintf "demo/data/%s" (Uuidm.to_string election.e_uuid) in let dir = Printf.sprintf "demo/data/%s" (Uuidm.to_string params.e_uuid) in
Unix.mkdir dir 0o755; Unix.mkdir dir 0o755;
let open Serializable_j in let open Serializable_j in
let number = Serializable_builtin_j.write_number in let number = Serializable_builtin_j.write_number in
save_to (dir/"election.json") (write_election write_ff_pubkey) election; save_to (dir/"election.json") (write_params write_ff_pubkey) params;
save_to (dir/"metadata.json") write_metadata metadata; save_to (dir/"metadata.json") write_metadata metadata;
list_save_to (dir/"private_keys.jsons") number private_keys; list_save_to (dir/"private_keys.jsons") number private_keys;
list_save_to (dir/"public_keys.jsons") (write_trustee_public_key number) public_keys; list_save_to (dir/"public_keys.jsons") (write_trustee_public_key number) public_keys;
......
...@@ -51,15 +51,15 @@ let () = Sys.chdir !dir ...@@ -51,15 +51,15 @@ let () = Sys.chdir !dir
(* Load and check election *) (* Load and check election *)
let election, election_fingerprint = let params, election_fingerprint =
match (load_from_file (fun l -> match (load_from_file (fun l ->
Serializable_j.(election_of_string read_ff_pubkey l), Serializable_j.(params_of_string read_ff_pubkey l),
sha256_b64 l sha256_b64 l
) "election.json") with ) "election.json") with
| Some [e] -> e | Some [e] -> e
| _ -> failwith "invalid election file" | _ -> failwith "invalid election file"
let {g; p; q; y} = election.e_public_key let {g; p; q; y} = params.e_public_key
let () = assert (Election.check_finite_field ~p ~q ~g) let () = assert (Election.check_finite_field ~p ~q ~g)
module G = (val Election.finite_field ~g ~p ~q : Election.FF_GROUP) module G = (val Election.finite_field ~g ~p ~q : Election.FF_GROUP)
...@@ -97,7 +97,7 @@ let metadata = ...@@ -97,7 +97,7 @@ let metadata =
module P = struct module P = struct
module G = G module G = G
let params = { election with e_public_key = y } let params = { params with e_public_key = y }
let metadata = metadata let metadata = metadata
let public_keys = lazy ( let public_keys = lazy (
match public_keys with match public_keys with
......
...@@ -47,7 +47,7 @@ type question = { ...@@ -47,7 +47,7 @@ type question = {
question : string; question : string;
} <ocaml field_prefix="q_"> } <ocaml field_prefix="q_">
type 'a election = { type 'a params = {
description : string; description : string;
name : string; name : string;
public_key : 'a; public_key : 'a;
......
...@@ -56,7 +56,7 @@ type question = { ...@@ -56,7 +56,7 @@ type question = {
tally_type : tally_type; tally_type : tally_type;
} <ocaml field_prefix="q_"> } <ocaml field_prefix="q_">
type 'a election = { type 'a params = {
cast_url : string; cast_url : string;
description : string; description : string;
frozen_at : datetime; frozen_at : datetime;
......
...@@ -10,7 +10,7 @@ let question q = ...@@ -10,7 +10,7 @@ let question q =
let open Serializable_t in let open Serializable_t in
{q_answers; q_min; q_max; q_question} {q_answers; q_min; q_max; q_question}
let election e = let params e =
let { let {
e_description; e_name; e_public_key; e_description; e_name; e_public_key;
e_questions; e_uuid; e_short_name; e_questions; e_uuid; e_short_name;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
open Serializable_compat_t open Serializable_compat_t
val election : 'a election -> 'a Serializable_t.election val params : 'a params -> 'a Serializable_t.params
val ballot : 'a ballot -> 'a Serializable_t.ballot val ballot : 'a ballot -> 'a Serializable_t.ballot
val partial_decryption : val partial_decryption :
'a partial_decryption -> 'a Serializable_t.partial_decryption 'a partial_decryption -> 'a Serializable_t.partial_decryption
......
...@@ -99,7 +99,7 @@ module type ELECTION_PARAMS = sig ...@@ -99,7 +99,7 @@ module type ELECTION_PARAMS = sig
(* TODO: public_keys is not needed during election, remove from (* TODO: public_keys is not needed during election, remove from
here, or at least monadify. *) here, or at least monadify. *)
val params : G.t Serializable_t.election val params : G.t Serializable_t.params
(** Parameters of the election. *) (** Parameters of the election. *)
val metadata : Serializable_t.metadata option val metadata : Serializable_t.metadata option
...@@ -126,7 +126,7 @@ module type ELECTION = sig ...@@ -126,7 +126,7 @@ module type ELECTION = sig
type private_key = Z.t type private_key = Z.t
type public_key = elt type public_key = elt
val election_params : elt Serializable_t.election val election_params : elt Serializable_t.params
(** {2 Ciphertexts} *) (** {2 Ciphertexts} *)
......
...@@ -104,18 +104,18 @@ lwt election_table = ...@@ -104,18 +104,18 @@ lwt election_table =
(* TODO: if the election is featured, show it on the home page *) (* TODO: if the election is featured, show it on the home page *)
return accu return accu
) else ( ) else (
let fn_election = path/"election.json" in let fn_params = path/"election.json" in
let fn_public_keys = path/"public_keys.jsons" in let fn_public_keys = path/"public_keys.jsons" in
lwt b = file_exists fn_election in lwt b = file_exists fn_params in
if b then ( if b then (
Ocsigen_messages.debug (fun () -> Ocsigen_messages.debug (fun () ->
"-- registering " ^ subdir "-- registering " ^ subdir
); );
lwt raw = lwt raw =
Lwt_io.chars_of_file fn_election |> Lwt_io.chars_of_file fn_params |>
Lwt_stream.to_string Lwt_stream.to_string
in in
let election = Serializable_j.election_of_string let params = Serializable_j.params_of_string
Serializable_j.read_ff_pubkey raw Serializable_j.read_ff_pubkey raw
in in
let fingerprint = sha256_b64 raw in let fingerprint = sha256_b64 raw in
...@@ -149,23 +149,23 @@ lwt election_table = ...@@ -149,23 +149,23 @@ lwt election_table =
) )
in in
let election_data = Web_common.({ let election_data = Web_common.({
fn_election; fn_params;
fingerprint; fingerprint;
election; params;
fn_public_keys; fn_public_keys;
public_creds; public_creds;
featured_p = true; featured_p = true;
can_read = Any; can_read = Any;
can_vote; can_vote;
}) in }) in
let {g; p; q; y} = election.e_public_key in let {g; p; q; y} = params.e_public_key in
let module G = (val let module G = (val
Election.finite_field ~p ~q ~g : Election.FF_GROUP Election.finite_field ~p ~q ~g : Election.FF_GROUP
) in ) in
let module P = struct let module P = struct
module G = G module G = G
let public_keys = lazy (assert false) let public_keys = lazy (assert false)
let params = { election with e_public_key = y } let params = { params with e_public_key = y }
let fingerprint = fingerprint let fingerprint = fingerprint
let metadata = metadata let metadata = metadata
end in end in
...@@ -178,7 +178,7 @@ lwt election_table = ...@@ -178,7 +178,7 @@ lwt election_table =
let data = election_data let data = election_data
end in end in
X.B.inject_creds public_creds >> X.B.inject_creds public_creds >>
let uuid = election.e_uuid in let uuid = params.e_uuid in
return (EMap.add uuid (module X : Web_common.WEB_ELECTION) accu) return (EMap.add uuid (module X : Web_common.WEB_ELECTION) accu)
) else return accu ) else return accu
) )
...@@ -380,7 +380,7 @@ let () = Eliom_registration.File.register ...@@ -380,7 +380,7 @@ let () = Eliom_registration.File.register
(if_eligible can_read (if_eligible can_read
(fun uuid election user () -> (fun uuid election user () ->
let module X = (val election : Web_common.WEB_ELECTION) in let module X = (val election : Web_common.WEB_ELECTION) in
return X.data.Web_common.fn_election return X.data.Web_common.fn_params
) )
) )
......
...@@ -157,7 +157,7 @@ let make_booth uuid = ...@@ -157,7 +157,7 @@ let make_booth uuid =
Eliom_uri.make_string_uri ~absolute_path:true ~service () Eliom_uri.make_string_uri ~absolute_path:true ~service ()
) )
let preapply_uuid s e = Eliom_service.preapply s e.Web_common.election.e_uuid let preapply_uuid s e = Eliom_service.preapply s e.Web_common.params.e_uuid
type savable_service = type savable_service =
| Home | Home
......
...@@ -104,9 +104,9 @@ let format_one_featured_election e = ...@@ -104,9 +104,9 @@ let format_one_featured_election e =
li [ li [
h3 [ h3 [
a ~service:Services.(preapply_uuid election_index e) a ~service:Services.(preapply_uuid election_index e)
[pcdata e.Web_common.election.e_name] (); [pcdata e.Web_common.params.e_name] ();
]; ];
p [pcdata e.Web_common.election.e_description]; p [pcdata e.Web_common.params.e_description];
] ]
let index ~auth_systems ~featured = let index ~auth_systems ~featured =
...@@ -227,9 +227,9 @@ let election_view ~auth_systems ~election ~user = ...@@ -227,9 +227,9 @@ let election_view ~auth_systems ~election ~user =
] ]
] in ] in
let content = [ let content = [
h1 [ pcdata election.Web_common.election.e_name ]; h1 [ pcdata election.Web_common.params.e_name ];
p ~a:[a_style "margin: 1em; padding: 2pt; font-style: italic; border: 1pt solid;"] [ p ~a:[a_style "margin: 1em; padding: 2pt; font-style: italic; border: 1pt solid;"] [
pcdata election.Web_common.election.e_description pcdata election.Web_common.params.e_description
]; ];
p voting_period; p voting_period;
p permissions; p permissions;
...@@ -247,7 +247,7 @@ let election_view ~auth_systems ~election ~user = ...@@ -247,7 +247,7 @@ let election_view ~auth_systems ~election ~user =
br (); br ();
audit_info; audit_info;
] in ] in
base ~auth_systems ~title:election.Web_common.election.e_name ~content base ~auth_systems ~title:election.Web_common.params.e_name ~content
let election_cast_raw ~election = let election_cast_raw ~election =
let module X = (val election : Web_common.WEB_ELECTION) in let module X = (val election : Web_common.WEB_ELECTION) in
...@@ -259,7 +259,7 @@ let election_cast_raw ~election = ...@@ -259,7 +259,7 @@ let election_cast_raw ~election =
div [textarea ~a:[a_rows 10; a_cols 40] ~name ()]; div [textarea ~a:[a_rows 10; a_cols 40] ~name ()];
div [string_input ~input_type:`Submit ~value:"Submit" ()]; div [string_input ~input_type:`Submit ~value:"Submit" ()];
] ]
) election.Web_common.election.e_uuid ) election.Web_common.params.e_uuid
in in
let form_upload = post_form ~service:Services.election_cast_post let form_upload = post_form ~service:Services.election_cast_post
(fun (_, name) -> (fun (_, name) ->
...@@ -271,19 +271,19 @@ let election_cast_raw ~election = ...@@ -271,19 +271,19 @@ let election_cast_raw ~election =
]; ];
div [string_input ~input_type:`Submit ~value:"Submit" ()]; div [string_input ~input_type:`Submit ~value:"Submit" ()];
] ]
) election.Web_common.election.e_uuid ) election.Web_common.params.e_uuid
in in
let content = [ let content = [
h1 [ pcdata election.Web_common.election.e_name ]; h1 [ pcdata election.Web_common.params.e_name ];
h3 [ pcdata "Submit by copy/paste" ]; h3 [ pcdata "Submit by copy/paste" ];
form_rawballot; form_rawballot;
h3 [ pcdata "Submit by file" ]; h3 [ pcdata "Submit by file" ];
form_upload; form_upload;
] in ] in
base ~title:election.Web_common.election.e_name ~content base ~title:election.Web_common.params.e_name ~content
let ballot_received ~election ~confirm ~user ~can_vote = let ballot_received ~election ~confirm ~user ~can_vote =
let name = election.Web_common.election.e_name in let name = election.Web_common.params.e_name in
let user_div = match user with let user_div = match user with
| Some u when can_vote -> | Some u when can_vote ->
let service = confirm () in let service = confirm () in
...@@ -295,7 +295,7 @@ let ballot_received ~election ~confirm ~user ~can_vote = ...@@ -295,7 +295,7 @@ let ballot_received ~election ~confirm ~user ~can_vote =
string_input ~input_type:`Submit ~value:"I confirm my vote" (); string_input ~input_type:`Submit ~value:"I confirm my vote" ();
pcdata "."; pcdata ".";
] ]
]) election.Web_common.election.e_uuid ]) election.Web_common.params.e_uuid
| Some _ -> | Some _ ->
div [ div [
pcdata "You cannot vote in this election!"; pcdata "You cannot vote in this election!";
...@@ -323,7 +323,7 @@ let ballot_received ~election ~confirm ~user ~can_vote = ...@@ -323,7 +323,7 @@ let ballot_received ~election ~confirm ~user ~can_vote =
base ~title:name ~content base ~title:name ~content
let do_cast_ballot ~election ~result = let do_cast_ballot ~election ~result =
let name = election.Web_common.election.e_name in let name = election.Web_common.params.e_name in
let content = [ let content = [
h1 [ pcdata name ]; h1 [ pcdata name ];
p [ p [
...@@ -359,10 +359,10 @@ let election_update_credential ~election = ...@@ -359,10 +359,10 @@ let election_update_credential ~election =
]; ];
div [string_input ~input_type:`Submit ~value:"Submit" ()]; div [string_input ~input_type:`Submit ~value:"Submit" ()];
] ]
) election.Web_common.election.e_uuid ) election.Web_common.params.e_uuid
in in
let content = [ let content = [
h1 [ pcdata election.Web_common.election.e_name ]; h1 [ pcdata election.Web_common.params.e_name ];
form; form;
] in ] in
base ~title:election.Web_common.election.e_name ~content base ~title:election.Web_common.params.e_name ~content
...@@ -27,9 +27,9 @@ type acl = ...@@ -27,9 +27,9 @@ type acl =
module SSet = Set.Make(String) module SSet = Set.Make(String)
type election_data = { type election_data = {
fn_election : string; fn_params : string;
fingerprint : string; fingerprint : string;
election : ff_pubkey election; params : ff_pubkey params;
fn_public_keys : string; fn_public_keys : string;
public_creds : SSet.t; public_creds : SSet.t;
featured_p : bool; featured_p : bool;
......
...@@ -18,9 +18,9 @@ type acl = ...@@ -18,9 +18,9 @@ type acl =
module SSet : Set.S with type elt = string module SSet : Set.S with type elt = string
type election_data = { type election_data = {
fn_election : string; fn_params : string;
fingerprint : string; fingerprint : string;
election : ff_pubkey election; params : ff_pubkey params;
fn_public_keys : string; fn_public_keys : string;
public_creds : SSet.t; public_creds : SSet.t;
featured_p : bool; featured_p : bool;
......
...@@ -32,7 +32,7 @@ let y = KG.combine public_keys ...@@ -32,7 +32,7 @@ let y = KG.combine public_keys
(* Setup election *) (* Setup election *)
let election = { let params = {
e_description = "This is a test election."; e_description = "This is a test election.";
e_name = "Test election"; e_name = "Test election";
e_public_key = G.({g; p; q; y}); e_public_key = G.({g; p; q; y});
...@@ -81,5 +81,5 @@ let save_to filename writer x = ...@@ -81,5 +81,5 @@ let save_to filename writer x =
close_out oc;; close_out oc;;
open Serializable_j;; open Serializable_j;;
save_to "election.json" (write_election write_ff_pubkey) election;; save_to "election.json" (write_params write_ff_pubkey) params;;
save_to "metadata.json" write_metadata metadata;; save_to "metadata.json" write_metadata metadata;;
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