Warning: Reason support is experimental. We are looking for beta-tester and contributors.

Module Os_session

module Os_session : sig..end

exception Not_connected
exception Permission_denied
val connected_fun : 
  ?allow:Os_types.Group.t list ->
  ?deny:Os_types.Group.t list ->
  ?deny_fun:(Os_types.User.id option -> 'c Lwt.t) ->
  (Os_types.User.id -> 'a -> 'b -> 'c Lwt.t) -> 'a -> 'b -> 'c Lwt.t

Wrapper for service handlers that fetches automatically connection information. Register (connected_fun f) as handler for your services, where f is a function taking user id, GET parameters and POST parameters. If no user is connected, the service will fail by raising Not_connected. Otherwise it calls function f. To provide another behaviour in case the user is not connected, have a look at Os_session.Opt.connected_fun or module Os_page.

Arguments ?allow and ?deny make possible to restrict access to some user groups. If access is denied, function ?deny_fun will be called. By default, it raises Permission denied.

When called on client side, no security check is done.

If optional argument force_unconnected is true, it will not try to find session information, and behave as if user were not connected (default is false). This allows to use functions from module Os_current_user in functions outside application without failing.

Use only one connection wrapper for each request!

val connected_rpc : 
  ?allow:Os_types.Group.t list ->
  ?deny:Os_types.Group.t list ->
  ?deny_fun:(Os_types.User.id option -> 'b Lwt.t) ->
  (Os_types.User.id -> 'a -> 'b Lwt.t) -> 'a -> 'b Lwt.t

Wrapper for server functions (see Os_session.connected_fun).

val connected_wrapper : 
  ?allow:Os_types.Group.t list ->
  ?deny:Os_types.Group.t list ->
  ?deny_fun:(Os_types.User.id option -> 'b Lwt.t) ->
  ?force_unconnected:bool -> ('a -> 'b Lwt.t) -> 'a -> 'b Lwt.t

Wrapper for server functions when you do not need userid (see Os_session.connected_fun). It is recommended to use this wrapper for all your server functions!

module Opt : sig..end