Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
belenios
belenios
Commits
ff4bb45e
Commit
ff4bb45e
authored
Mar 24, 2014
by
Stephane Glondu
Browse files
Move do_log{in,out} out of AUTH_SERVICES
Rationale: we don't want templates to be able to call them.
parent
6b9be734
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/web/web_auth.ml
View file @
ff4bb45e
...
...
@@ -116,13 +116,17 @@ module Make (N : CONFIG) = struct
~
get_params
:
Eliom_parameter
.(
opt
(
string
"service"
))
()
let
do_login
cont
()
=
login_handler
None
cont
let
logout
=
Eliom_service
.
service
~
path
:
(
N
.
path
@
[
"logout"
])
~
get_params
:
Eliom_parameter
.
unit
()
end
module
Handlers
:
AUTH_HANDLERS_PUBLIC
=
struct
let
do_login
cont
()
=
login_handler
None
cont
let
do_logout
cont
()
=
match_lwt
Eliom_reference
.
get
user
with
|
Some
u
->
...
...
@@ -136,7 +140,7 @@ module Make (N : CONFIG) = struct
end
module
Register
(
S
:
SITE
_SERVICES
)
(
T
:
TEMPLATES
)
:
EMPTY
=
struct
module
Register
(
S
:
SITE
)
(
T
:
TEMPLATES
)
:
EMPTY
=
struct
let
()
=
login_choose
:=
T
.
login_choose
...
...
@@ -177,7 +181,7 @@ module Make (N : CONFIG) = struct
~
service
:
Services
.
logout
(
fun
()
()
->
lwt
cont
=
Eliom_reference
.
get
S
.
cont
in
Service
s
.
do_logout
cont
()
Handler
s
.
do_logout
cont
()
)
end
...
...
src/web/web_auth.mli
View file @
ff4bb45e
...
...
@@ -41,5 +41,6 @@ end
module
Make
(
C
:
CONFIG
)
:
sig
module
Services
:
AUTH_SERVICES
module
Register
(
S
:
SITE_SERVICES
)
(
T
:
TEMPLATES
)
:
EMPTY
module
Handlers
:
AUTH_HANDLERS_PUBLIC
module
Register
(
S
:
SITE
)
(
T
:
TEMPLATES
)
:
EMPTY
end
src/web/web_election.ml
View file @
ff4bb45e
...
...
@@ -46,7 +46,7 @@ let can_vote m user =
module
type
REGISTRATION
=
sig
module
W
:
WEB_ELECTION
module
Register
(
S
:
SITE
_SERVICES
)
(
T
:
ELECTION_TEMPLATES
)
:
EMPTY
module
Register
(
S
:
SITE
)
(
T
:
ELECTION_TEMPLATES
)
:
EMPTY
end
let
make
{
raw_election
;
metadata
;
featured
;
params_fname
;
public_keys_fname
}
=
...
...
@@ -292,7 +292,7 @@ let make {raw_election; metadata; featured; params_fname; public_keys_fname} =
end
module
Register
(
S
:
SITE
_SERVICES
)
(
T
:
ELECTION_TEMPLATES
)
:
EMPTY
=
struct
module
Register
(
S
:
SITE
)
(
T
:
ELECTION_TEMPLATES
)
:
EMPTY
=
struct
open
Eliom_registration
let
if_eligible
acl
f
()
x
=
...
...
src/web/web_election.mli
View file @
ff4bb45e
...
...
@@ -27,7 +27,7 @@ open Web_signatures
module
type
REGISTRATION
=
sig
module
W
:
WEB_ELECTION
module
Register
(
S
:
SITE
_SERVICES
)
(
T
:
ELECTION_TEMPLATES
)
:
EMPTY
module
Register
(
S
:
SITE
)
(
T
:
ELECTION_TEMPLATES
)
:
EMPTY
end
val
make
:
election_config
->
(
module
REGISTRATION
)
src/web/web_signatures.mli
View file @
ff4bb45e
...
...
@@ -156,6 +156,11 @@ module type AUTH_HANDLERS = sig
val
logout
:
unit
service_cont
end
module
type
AUTH_HANDLERS_PUBLIC
=
sig
val
do_login
:
unit
service_cont
val
do_logout
:
unit
service_cont
end
module
type
AUTH_SERVICES
=
sig
val
get_auth_systems
:
unit
->
string
list
...
...
@@ -180,9 +185,6 @@ module type AUTH_SERVICES = sig
[
<
Eliom_service
.
registrable
>
`Registrable
]
,
'
a
)
Eliom_service
.
service
val
do_login
:
unit
service_cont
val
do_logout
:
unit
service_cont
end
module
type
WEB_BALLOT_BOX
=
sig
...
...
@@ -247,12 +249,14 @@ end
module
type
SITE_SERVICES
=
sig
include
CORE_SERVICES
include
AUTH_SERVICES
end
module
type
SITE
=
sig
include
SITE_SERVICES
include
AUTH_HANDLERS_PUBLIC
val
register_election
:
election_config
->
(
module
WEB_ELECTION
)
Lwt
.
t
val
set_main_election
:
(
module
WEB_ELECTION
)
->
unit
val
unset_main_election
:
unit
->
unit
val
cont
:
(
unit
->
service_handler
)
Eliom_reference
.
eref
end
...
...
src/web/web_site.ml
View file @
ff4bb45e
...
...
@@ -34,7 +34,7 @@ module type CONFIG = sig
val
instances
:
Web_auth
.
auth_instance
list
end
module
Make
(
C
:
CONFIG
)
:
SITE
_SERVICES
=
struct
module
Make
(
C
:
CONFIG
)
:
SITE
=
struct
open
Eliom_service
open
Eliom_registration
...
...
@@ -55,8 +55,9 @@ module Make (C : CONFIG) : SITE_SERVICES = struct
and Web_election. S is not meant to leak and will be included
in the returned module later. *)
module
S
:
SITE
_SERVICES
=
struct
module
S
:
SITE
=
struct
include
Auth
.
Services
include
Auth
.
Handlers
open
Eliom_parameter
let
scope
=
Eliom_common
.
default_session_scope
...
...
src/web/web_site.mli
View file @
ff4bb45e
...
...
@@ -28,4 +28,4 @@ module type CONFIG = sig
val
instances
:
Web_auth
.
auth_instance
list
end
module
Make
(
C
:
CONFIG
)
:
SITE
_SERVICES
module
Make
(
C
:
CONFIG
)
:
SITE
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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