user_profile.pl -- User Profile Management
This module implements user profile management, in particular for managing authentication and authorization for HTTP servers. It mainly defines the interface that can be used within an HTTP application.
The actual storage is left to a plugin providing the backend implementation. Backend choices may depend on integration needs with other services, scale of the site (number of users), distribution, ease of installation.
The typical setup sequence is
:- use_module(library(http/user_profile)). :- use_module(library(http/impl/profile_prolog)). :- set_setting(user_profile:backend, impl_profile_prolog). :- multifile user_profile:attribute/3. user_profile:attribute_type(name, string, []). ...
- profile_open_db(+Options) is det
- Open the profile database. Must be called before any of the other profile API predicates. Options depend on the used backend.
- profile_create(?ProfileID, +Attributes) is det
- Create a new user profile with the given initial attributes.
- profile_canonical_value(+Attribute, +ValueIn, -Value) is det
- True when Value is the canonical value for Attribute that satisfies the type constraint for Attribute.
- current_profile(?ProfileID) is nondet
- True when ProfileID is a currently known user profile.
- current_profile(?ProfileID, -Attributes:dict) is nondet
- True when ProfileID is a currently known user profile with the given attributes.
- profile_property(?ProfileID, ?Property:compound) is nondet
- True when the user with ProfileID has Property. Property is a term Name(Value).
- set_profile(+ProfileID, +Attribute) is det
- set_profile(+ProfileID, +Attribute, -Modified) is det
- Set an attribute of the profile.
- profile_remove(+ProfileID) is det
- Completely destroy a profile.
- profile_remove(+ProfileID, +Attribute) is det
- Remove an attribute from a profile.
- profile_add_session(+ProfileID, +SessionID, +Options) is det
- Associate a profile with a session (login). Options defined are:
- timeout(+Seconds)
- Max idle time for the session.
- persistent(+Boolean)
- If
true
, store the session association persistently, such that a server restart maintains the login.
- profile_refresh_session(+ProfileID, +SessionID) is det
- Update the last access time for the indicated session.
- profile_remove_session(+ProfileID, +SessionID) is det
- Remove the association of a profile with a session (logout).
- profile_session(?ProfileID, ?SessionID) is nondet
- True when ProfileID is associated (logged in) with SessionID.
- error:has_type(+Type, +Value) is semidet[multifile]
- True if Value satisfies Type. This implementation extends the type logic defined in library(error) with some types that commonly apply to user profiles.
Re-exported predicates
The following predicates are exported from this file while their implementation is defined in imported modules or non-module files loaded by this module.
- set_profile(+ProfileID, +Attribute) is det
- set_profile(+ProfileID, +Attribute, -Modified) is det
- Set an attribute of the profile.