meta data for this page
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| develop:authentication_plugin [2015/12/06 16:12] – created phplist | develop:authentication_plugin [2015/12/07 09:01] (current) – phplist | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | As of version XX of phpList, authentication can be provided by a plugin. | ||
| + | |||
| + | You can check the // | ||
| + | |||
| + | Below is a skeleton class. Not all methods need to be implemented, | ||
| + | |||
| + | < | ||
| + | class myCustomPhpListAdminAuthentication extends phplistPlugin { | ||
| + | public $name = 'your plugin name'; | ||
| + | public $version = 0.1; | ||
| + | public $authors = 'Your name'; | ||
| + | public $description = ' | ||
| + | public $authProvider = true; | ||
| + | |||
| + | /** | ||
| + | | ||
| + | * validateLogin, | ||
| + | | ||
| + | * @param string $login the login field | ||
| + | * @param string $password the password | ||
| + | | ||
| + | * @return array | ||
| + | | ||
| + | | ||
| + | | ||
| + | * eg | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | public function validateLogin($login, | ||
| + | { | ||
| + | |||
| + | return array(0, | ||
| + | } | ||
| + | |||
| + | /** | ||
| + | | ||
| + | * validateAccount, | ||
| + | | ||
| + | * this allows verification that the admin still exists and is valid | ||
| + | | ||
| + | * @param int $id the ID of the admin as provided by validateLogin | ||
| + | | ||
| + | * @return array | ||
| + | | ||
| + | | ||
| + | | ||
| + | * eg | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | public function validateAccount($id) | ||
| + | { | ||
| + | return array(1," | ||
| + | } | ||
| + | |||
| + | |||
| + | |||
| + | /** | ||
| + | * adminName | ||
| + | | ||
| + | * Name of the currently logged in administrator | ||
| + | * Use for logging, eg " | ||
| + | * and to display ownership of lists | ||
| + | | ||
| + | * @param int $id ID of the admin | ||
| + | | ||
| + | * @return string; | ||
| + | */ | ||
| + | public function adminName($id) | ||
| + | { | ||
| + | } | ||
| + | | ||
| + | /** | ||
| + | * adminEmail | ||
| + | | ||
| + | * Email address of the currently logged in administrator | ||
| + | * used to potentially pre-fill the " | ||
| + | | ||
| + | * @param int $id ID of the admin | ||
| + | | ||
| + | * @return string; | ||
| + | */ | ||
| + | public function adminEmail($id) | ||
| + | { | ||
| + | } | ||
| + | |||
| + | /** | ||
| + | * adminIdForEmail | ||
| + | | ||
| + | * Return matching admin ID for an email address | ||
| + | * used for verifying the admin email address on a Forgot Password request | ||
| + | | ||
| + | * @param string $email email address | ||
| + | | ||
| + | * @return ID if found or false if not; | ||
| + | */ | ||
| + | public function adminIdForEmail($email) | ||
| + | { | ||
| + | } | ||
| + | | ||
| + | /** | ||
| + | * isSuperUser | ||
| + | | ||
| + | * Return whether this admin is a super-admin or not | ||
| + | | ||
| + | * @param int $id admin ID | ||
| + | | ||
| + | * @return true if super-admin false if not | ||
| + | */ | ||
| + | public function isSuperUser($id) | ||
| + | { | ||
| + | } | ||
| + | |||
| + | /** | ||
| + | * listAdmins | ||
| + | | ||
| + | * Return array of admins in the system | ||
| + | * Used in the list page to allow assigning ownership to lists | ||
| + | | ||
| + | * @param none | ||
| + | | ||
| + | * @return array of admins | ||
| + | | ||
| + | */ | ||
| + | function listAdmins() | ||
| + | { | ||
| + | } | ||
| + | |||
| + | | ||
| + | |||
| + | | ||
| + | } | ||
| + | </ | ||