Authentication modules are pieces of code that allow Observium to use different sorts of user databases. They also take care of changing passwords (or disallowing it) and other related things. You can use any of the supplied ones to start from.
Please do send us a patch if you create something new! That way it will (hopefully) also be automatically updated if we add new interface functions.
The modules are included upon every page load; if you need initialization code (connecting to an LDAP server, etc), you can place it outside of a function, the code will be run automagically.
If you write module-specific functions, please mark them as such in the source code so the difference between our auth "API" and local functions is clear. Please name them so they won't conflict with future Observium-internal functions!
Auth modules live in
html/includes/authentication and should end in
.inc.php. They need to have the following functions:
Check the combination of username and password.
function auth_can_change_password($username = "")
1 if the module can change user passwords,
0 if it cannot. The username is passed on as well, if your module supports locking certain users' passwords.
Change the user's password to a new value, if passwords can be changed.
TRUE if the module allows users to log out,
FALSE if it doesn't.
Check if this username exists.
Return the user level of the specified user.
Return the user id of the specified user.
Returns a list of users in an array with the following keys: username, realname, user_id
1 if the module can do user management,
0 if it cannot.
function adduser($username, $password, $level, $email = "", $realname = "", $can_modify_passwd = '1')
Add a user with the specified attributes, if user management is allowed.
Deletes the specified user, if user management is allowed.