Module User

module User : sig..end

Module Users.

Users, authentication, protection.

In this model, users and groups are the same concept. A group can belong to another group. We only distinguish, for practical matters, between "login enabled" users and "group only" users: the former has Some (eventually void) password, the latter has None.


exception ConnectionRefused
exception BadPassword
exception BadUser
exception UnknownUser of string
exception UseAuth of User_sql.Types.userid
val anonymous : User_sql.Types.userid

Non authenticated users

val anonymous_login : string
val admin : User_sql.Types.userid

A user that belongs to all groups

val admin_login : string
val nobody : User_sql.Types.userid

A user/group that does not belong to any group, and in which nobody can be.

val nobody_login : string
val authenticated_users : User_sql.Types.userid

A group containing all authenticated users (not groups)

val group_can_create_groups : User_sql.Types.user

The groups of users that can create new groups

val group_can_create_users : User_sql.Types.user

Same thing with users

val group_can_admin_users : User_sql.Types.user

The groups of users that can modify the users settings

val group_can_admin_group : [ `User ] User_sql.Types.parameterized_group

The group of users that can add or remove people in the given user/group

val get_basicuser_by_login : string -> User_sql.Types.userid Lwt.t

Information about a user. Return nobody if the user does not currently exists, and raises User_sql.NotBasicUser if the user does not correspond to a basic user.

val get_user_by_name : string -> User_sql.Types.user Lwt.t

Returns the user that corresponds to a given string (inverse of the function User_sql.user_to_string, or nobody if the user does not exists

val user_list_of_string : string -> User_sql.Types.user list Lwt.t

Convert a list of string representation of users into the corresponding users, according to get_user_by_name. Nobody is never returned. Fails with UnknownUser u if the user u is not recognized

val create_user : 
  name:string ->
  pwd:User_sql.Types.pwd ->
  fullname:string ->
  ?email:string ->
  ?test:(unit -> bool Lwt.t) -> unit -> User_sql.Types.userid Lwt.t

Creates a new user or group with given parameters, or returns the existing user without modification if name is already present.

val create_fresh_user : 
  name:string ->
  pwd:User_sql.Types.pwd ->
  fullname:string ->
  ?email:string -> unit -> User_sql.Types.userid Lwt.t

Same as above, except that the function will raise BadUser if the user already exists

val create_external_user : string -> User_sql.Types.userid Lwt.t

Same as create_user, but only for external users

val authenticate : 
  name:string -> pwd:string -> User_sql.Types.userdata Lwt.t
val add_to_group : 
  user:User_sql.Types.user -> group:User_sql.Types.user -> unit Lwt.t

Atomic change in one group

val remove_from_group : 
  user:User_sql.Types.user -> group:User_sql.Types.user -> unit Lwt.t
val add_to_groups : 
  user:User_sql.Types.user ->
  groups:User_sql.Types.user list -> unit Lwt.t

Multiple operations on groups

val add_list_to_group : 
  l:User_sql.Types.user list -> group:User_sql.Types.user -> unit Lwt.t
val remove_list_from_group : 
  l:User_sql.Types.user list -> group:User_sql.Types.user -> unit Lwt.t
val in_group : 
  ?user:User_sql.Types.user ->
  group:User_sql.Types.user -> unit -> bool Lwt.t

Informations on the loggued user

val get_user_data : unit -> User_sql.Types.userdata Lwt.t
val get_user_id : unit -> User_sql.Types.userid Lwt.t
val get_user_name : unit -> string Lwt.t
val is_logged_on : unit -> bool Lwt.t
val set_session_data : User_sql.Types.userid * string -> unit Lwt.t
val user_from_userlogin_xform : 
  string -> User_sql.Types.user Xform.convert Lwt.t
module GenericRights : sig..end