Commit c0d0e462 authored by Stephane Glondu's avatar Stephane Glondu

Do not hard-code default group in web server

parent 4e22b17b
......@@ -46,6 +46,7 @@
<auth name="local"><password db="demo/password_db.csv"/></auth>
<!-- <auth name="google"><oidc server="https://accounts.google.com" client_id="client-id" client_secret="client-secret"/></auth> -->
<source file="../belenios.tar.gz"/>
<default-group file="demo/groups/default.json"/>
<log file="_RUNDIR_/log/security.log"/>
<spool dir="_RUNDIR_/spool"/>
</eliom>
......
......@@ -38,6 +38,7 @@ let spool_dir = ref None
let source_file = ref None
let auth_instances = ref []
let gdpr_uri = ref None
let default_group_file = ref None
let () =
Eliom_config.get_config () |>
......@@ -49,6 +50,8 @@ let () =
Lwt_main.run (open_security_log file)
| Element ("source", ["file", file], []) ->
source_file := Some file
| Element ("default-group", ["file", file], []) ->
default_group_file := Some file
| Element ("maxmailsatonce", ["value", limit], []) ->
Web_site.maxmailsatonce := int_of_string limit
| Element ("uuid", ["length", length], []) ->
......@@ -116,8 +119,18 @@ let spool_dir =
| Some d -> d
| None -> failwith "missing <spool> in configuration"
let%lwt default_group =
match !default_group_file with
| None -> failwith "missing <default-group> in configuration"
| Some x ->
let%lwt x = Lwt_io.lines_of_file x |> Lwt_stream.to_list in
match x with
| [x] -> return x
| _ -> failwith "invalid default group file"
(** Build up the site *)
let () = Web_site.source_file := source_file
let () = Web_common.spool_dir := spool_dir
let () = Web_site.default_group := default_group
let () = Web_auth.configure (List.rev !auth_instances)
......@@ -33,6 +33,7 @@ open Web_services
let source_file = ref "belenios.tar.gz"
let maxmailsatonce = ref 1000
let uuid_length = ref None
let default_group = ref ""
let ( / ) = Filename.concat
......@@ -409,7 +410,7 @@ let create_new_election owner cred auth =
} in
let se = {
se_owner = owner;
se_group = "{\"g\":\"2402352677501852209227687703532399932712287657378364916510075318787663274146353219320285676155269678799694668298749389095083896573425601900601068477164491735474137283104610458681314511781646755400527402889846139864532661215055797097162016168270312886432456663834863635782106154918419982534315189740658186868651151358576410138882215396016043228843603930989333662772848406593138406010231675095763777982665103606822406635076697764025346253773085133173495194248967754052573659049492477631475991575198775177711481490920456600205478127054728238140972518639858334115700568353695553423781475582491896050296680037745308460627\",\"p\":\"20694785691422546401013643657505008064922989295751104097100884787057374219242717401922237254497684338129066633138078958404960054389636289796393038773905722803605973749427671376777618898589872735865049081167099310535867780980030790491654063777173764198678527273474476341835600035698305193144284561701911000786737307333564123971732897913240474578834468260652327974647951137672658693582180046317922073668860052627186363386088796882120769432366149491002923444346373222145884100586421050242120365433561201320481118852408731077014151666200162313177169372189248078507711827842317498073276598828825169183103125680162072880719\",\"q\":\"78571733251071885079927659812671450121821421258408794611510081919805623223441\"}"; (* generated by fips.sage *)
se_group = !default_group;
se_voters = [];
se_questions;
se_public_keys = [];
......
......@@ -22,3 +22,4 @@
val source_file : string ref
val maxmailsatonce : int ref
val uuid_length : int option ref
val default_group : string ref
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