Authentication Modules
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.
Initialization
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!
Interface
Auth modules live in html/includes/authentication
and should end in .inc.php
. They need to have the following functions:
Authentication
Text Only | |
---|---|
1 |
|
Check the combination of username and password.
Text Only | |
---|---|
1 |
|
Return 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.
Text Only | |
---|---|
1 |
|
Change the user's password to a new value, if passwords can be changed.
Text Only | |
---|---|
1 |
|
Return TRUE
if the module allows users to log out, FALSE
if it doesn't.
User data
Text Only | |
---|---|
1 |
|
Check if this username exists.
Text Only | |
---|---|
1 |
|
Return the user level of the specified user.
Text Only | |
---|---|
1 |
|
Return the user id of the specified user.
Text Only | |
---|---|
1 |
|
Returns a list of users in an array with the following keys: username, realname, user_id
User management
Text Only | |
---|---|
1 |
|
Return 1
if the module can do user management, 0
if it cannot.
Text Only | |
---|---|
1 |
|
Add a user with the specified attributes, if user management is allowed.
Text Only | |
---|---|
1 |
|
Deletes the specified user, if user management is allowed.