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

Module User_sql.Types

module Types : sig..end

type userid = [ `User ] Opaque.int32_t

The abstract type of user ids

val userid_from_sql : int32 -> userid
val sql_from_userid : userid -> int32
val string_from_userid : userid -> string
type pwd =  | Connect_forbidden | Ocsimore_user_plain of string | Ocsimore_user_crypt of string | Ocsimore_user_safe of Bcrypt.hash_t | External_Auth
type find_param = {
  param_description: string;  param_get: 
    unit ->
    < id : < get : unit; nul : Sql.non_nullable; t : Sql.int32_t >
     Sql.t;
     title : < get : unit; nul : Sql.nullable; t : Sql.string_t >
     Sql.t >
    list Lwt.t
;
  param_display: (int32 -> string Lwt.t) option;  find_param_functions:
    ((string -> int32 Lwt.t) * (int32 -> string Lwt.t)) option
;
}

Description of the parameter of a paramaterized group

type userdata = {
  user_id: userid;  user_login: string;  user_pwd: pwd;  user_fullname: string;  user_email: string option;  user_dyn: bool;  user_kind: 
    [ `BasicUser
    | `NonParameterizedGroup
    | `ParameterizedGroup of find_param option ]
;
}
type 'a parameterized_group
val parameterized_group_from_userid : userid -> 'a parameterized_group
type user
val apply_parameterized_group : 
  'a parameterized_group ->
  'a Opaque.int32_t -> user
val ($) : 
  'a parameterized_group ->
  'a Opaque.int32_t -> user
val basic_user : userid -> user
val non_parameterized_group : userid -> user
val userid_from_user : user -> userid
val is_basic_user : user -> userid option

Converts an user back into an userid, if possible

val user_is_applied_parameterized_group : 
  user:user ->
  pgroup:'a parameterized_group ->
  'a Opaque.int32_t option

Returns Some v is user is group $ v, or None otherwise

type 'a admin_writer_reader = {
  grp_admin: 'a parameterized_group;  grp_writer: 'a parameterized_group;  grp_reader: 'a parameterized_group;}
type users = {
  users: userdata list Lazy.t;  groups: userdata list Lazy.t;  roles: userdata list Lazy.t;}