Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
belenios
belenios
Commits
6b6298f3
Commit
6b6298f3
authored
Jun 19, 2013
by
Stephane Glondu
Browse files
Add Services.election_public_keys
parent
071f86a0
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/web/common.ml
View file @
6b6298f3
...
...
@@ -22,6 +22,7 @@ type election_data = {
fingerprint
:
string
;
election
:
ff_pubkey
election
;
public_keys
:
Z
.
t
trustee_public_key
array
;
public_keys_file
:
string
;
election_result
:
Z
.
t
result
option
;
author
:
user
;
featured_p
:
bool
;
...
...
@@ -68,8 +69,9 @@ let load_elections_and_votes dirname =
Serializable_j
.
read_ff_pubkey
raw
in
(
assert_lwt
(
Uuidm
.
equal
uuid
election
.
e_uuid
))
>>
let
public_keys_file
=
data
"public_keys.jsons"
in
lwt
public_keys
=
data
"
public_keys
.jsons"
|>
public_keys
_file
|>
Lwt_io
.
lines_of_file
|>
Lwt_stream
.
map
(
fun
x
->
Serializable_j
.
trustee_public_key_of_string
Serializable_builtin_j
.
read_number
x
...
...
@@ -99,6 +101,7 @@ let load_elections_and_votes dirname =
fingerprint
;
election
;
public_keys
;
public_keys_file
;
election_result
;
author
=
{
user_name
=
"admin"
;
user_type
=
Dummy
};
featured_p
=
true
;
...
...
src/web/common.mli
View file @
6b6298f3
...
...
@@ -18,6 +18,7 @@ type election_data = {
fingerprint
:
string
;
election
:
ff_pubkey
election
;
public_keys
:
Z
.
t
trustee_public_key
array
;
public_keys_file
:
string
;
election_result
:
Z
.
t
result
option
;
author
:
user
;
featured_p
:
bool
;
...
...
src/web/registration.ml
View file @
6b6298f3
...
...
@@ -185,6 +185,15 @@ let () = Eliom_registration.String.register
)
)
let
()
=
Eliom_registration
.
File
.
register
~
service
:
Services
.
election_public_keys
~
content_type
:
"application/json"
(
if_eligible
can_read
(
fun
uuid
election
user
()
->
return
election
.
Common
.
public_keys_file
)
)
let
()
=
Eliom_registration
.
String
.
register
~
service
:
Services
.
election_ballots
(
if_eligible
can_read
...
...
src/web/services.ml
View file @
6b6298f3
...
...
@@ -79,6 +79,11 @@ let election_raw = service
~
get_params
:
uuid
()
let
election_public_keys
=
service
~
path
:
[
"election"
;
"public_keys"
]
~
get_params
:
uuid
()
let
election_vote
=
service
~
path
:
[
"election"
;
"vote"
]
~
get_params
:
uuid
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment