auth:punbb
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
auth:punbb [2011-01-01 21:21] – dokuwiki 2010-11-07 "Anteater" 77.199.212.204 | auth:punbb [2017-02-07 09:41] – old revision restored (2013-06-09 23:58) 130.112.1.3 | ||
---|---|---|---|
Line 13: | Line 13: | ||
The backend reuses your PunBB configuration. You just need to enable it and set is the '' | The backend reuses your PunBB configuration. You just need to enable it and set is the '' | ||
- | <code php> | + | < |
+ | <?php | ||
$conf[' | $conf[' | ||
$conf[' | $conf[' | ||
Line 408: | Line 409: | ||
[[oli_v_ier@yahoo.fr|olivier]] | [[oli_v_ier@yahoo.fr|olivier]] | ||
[[id.2ndr@laposte.net|id2ndr]] | [[id.2ndr@laposte.net|id2ndr]] | ||
- | |||
- | * Doesn' | ||
==== dokuwiki 2010-11-07 " | ==== dokuwiki 2010-11-07 " | ||
Line 419: | Line 418: | ||
* Add the line bellow in '' | * Add the line bellow in '' | ||
* Remove the line in '' | * Remove the line in '' | ||
+ | |||
+ | === PunBB CSRF & Ajax problem === | ||
+ | |||
+ | If you want to make ajax-quicksearch work, You should define the constant FORUM_SKIP_CSRF_CONFIRM before including any PunBB code | ||
+ | so, the code above should be like below : < | ||
+ | include PUN_ROOT.' | ||
+ | |||
+ | ==== Dokuwiki 2013-05-10 " | ||
+ | |||
+ | FIXME **CREATE authplugin for in the repository.** | ||
+ | |||
+ | * Configure the auth plugin in conf/ | ||
+ | * define(' | ||
+ | * require_once PUN_ROOT.' | ||
+ | * $conf[' | ||
+ | * Create the auth plugin : | ||
+ | * **Method 1** (crapy) Adapt from an existing source | ||
+ | * Copy the code of [[http:// | ||
+ | * Modify some code | ||
+ | * Remove < | ||
+ | * Class : < | ||
+ | * constructor < | ||
+ | parent:: | ||
+ | * **Method 2** Put this code in lib/ | ||
+ | <?php | ||
+ | /** | ||
+ | * DokuWiki Plugin authfluxbb (Auth Component) | ||
+ | * | ||
+ | * @license GPL 2 http:// | ||
+ | * @author | ||
+ | */ | ||
+ | |||
+ | // must be run within Dokuwiki | ||
+ | if(!defined(' | ||
+ | |||
+ | class auth_plugin_authfluxbb extends DokuWiki_Auth_Plugin { | ||
+ | |||
+ | |||
+ | /** | ||
+ | * Constructor. | ||
+ | */ | ||
+ | public function __construct() { | ||
+ | parent:: | ||
+ | |||
+ | // Set capabilities accordingly | ||
+ | $this-> | ||
+ | $this-> | ||
+ | $this-> | ||
+ | $this-> | ||
+ | $this-> | ||
+ | $this-> | ||
+ | $this-> | ||
+ | $this-> | ||
+ | $this-> | ||
+ | $this-> | ||
+ | $this-> | ||
+ | $this-> | ||
+ | |||
+ | |||
+ | // FIXME intialize your auth system and set success to true, if successful | ||
+ | $this-> | ||
+ | } | ||
+ | |||
+ | |||
+ | /** | ||
+ | * Log off the current user [ OPTIONAL ] | ||
+ | */ | ||
+ | //public function logOff() { | ||
+ | //} | ||
+ | |||
+ | /** | ||
+ | * Do all authentication [ OPTIONAL ] | ||
+ | * | ||
+ | * @param | ||
+ | * @param | ||
+ | * @param | ||
+ | * @return | ||
+ | */ | ||
+ | function trustExternal($user, | ||
+ | global $USERINFO; | ||
+ | global $conf; | ||
+ | global $lang; | ||
+ | global $pun_user; | ||
+ | global $pun_config; | ||
+ | global $cookie_name; | ||
+ | $sticky ? $sticky = true : $sticky = false; //sanity check | ||
+ | |||
+ | if(isset($pun_user) && !$pun_user[' | ||
+ | // okay we're logged in - set the globals | ||
+ | $USERINFO[' | ||
+ | $USERINFO[' | ||
+ | $USERINFO[' | ||
+ | $USERINFO[' | ||
+ | if ($pun_user[' | ||
+ | $USERINFO[' | ||
+ | |||
+ | $_SERVER[' | ||
+ | $_SESSION[DOKU_COOKIE][' | ||
+ | $_SESSION[DOKU_COOKIE][' | ||
+ | return true; | ||
+ | } | ||
+ | |||
+ | // to be sure | ||
+ | auth_logoff(); | ||
+ | |||
+ | $USERINFO[' | ||
+ | return false; | ||
+ | |||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Check user+password | ||
+ | * | ||
+ | * May be ommited if trustExternal is used. | ||
+ | * | ||
+ | * @param | ||
+ | * @param | ||
+ | * @return | ||
+ | */ | ||
+ | public function checkPass($user, | ||
+ | // FIXME implement password check | ||
+ | return false; // return true if okay | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Return user info | ||
+ | * | ||
+ | * Returns info about the given user needs to contain | ||
+ | * at least these fields: | ||
+ | * | ||
+ | * name string | ||
+ | * mail string | ||
+ | * grps array list of groups the user is in | ||
+ | * | ||
+ | * @param | ||
+ | * @return | ||
+ | */ | ||
+ | public function getUserData($user) { | ||
+ | // FIXME implement | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Create a new User [implement only where required/ | ||
+ | * | ||
+ | * Returns false if the user already exists, null when an error | ||
+ | * occurred and true if everything went well. | ||
+ | * | ||
+ | * The new user HAS TO be added to the default group by this | ||
+ | * function! | ||
+ | * | ||
+ | * Set addUser capability when implemented | ||
+ | * | ||
+ | * @param | ||
+ | * @param | ||
+ | * @param | ||
+ | * @param | ||
+ | * @param | ||
+ | * @return bool|null | ||
+ | */ | ||
+ | //public function createUser($user, | ||
+ | // FIXME implement | ||
+ | // return null; | ||
+ | //} | ||
+ | |||
+ | /** | ||
+ | * Modify user data [implement only where required/ | ||
+ | * | ||
+ | * Set the mod* capabilities according to the implemented features | ||
+ | * | ||
+ | * @param | ||
+ | * @param | ||
+ | * @return | ||
+ | */ | ||
+ | //public function modifyUser($user, | ||
+ | // FIXME implement | ||
+ | // return false; | ||
+ | //} | ||
+ | |||
+ | /** | ||
+ | * Delete one or more users [implement only where required/ | ||
+ | * | ||
+ | * Set delUser capability when implemented | ||
+ | * | ||
+ | * @param | ||
+ | * @return | ||
+ | */ | ||
+ | //public function deleteUsers($users) { | ||
+ | // FIXME implement | ||
+ | // return false; | ||
+ | //} | ||
+ | |||
+ | /** | ||
+ | * Bulk retrieval of user data [implement only where required/ | ||
+ | * | ||
+ | * Set getUsers capability when implemented | ||
+ | * | ||
+ | * @param | ||
+ | * @param | ||
+ | * @param | ||
+ | * @return | ||
+ | */ | ||
+ | //public function retrieveUsers($start = 0, $limit = -1, $filter = null) { | ||
+ | // FIXME implement | ||
+ | // return array(); | ||
+ | //} | ||
+ | |||
+ | /** | ||
+ | * Return a count of the number of user which meet $filter criteria | ||
+ | * [should be implemented whenever retrieveUsers is implemented] | ||
+ | * | ||
+ | * Set getUserCount capability when implemented | ||
+ | * | ||
+ | * @param | ||
+ | * @return int | ||
+ | */ | ||
+ | //public function getUserCount($filter = array()) { | ||
+ | // FIXME implement | ||
+ | // return 0; | ||
+ | //} | ||
+ | |||
+ | /** | ||
+ | * Define a group [implement only where required/ | ||
+ | * | ||
+ | * Set addGroup capability when implemented | ||
+ | * | ||
+ | * @param | ||
+ | * @return | ||
+ | */ | ||
+ | //public function addGroup($group) { | ||
+ | // FIXME implement | ||
+ | // return false; | ||
+ | //} | ||
+ | |||
+ | /** | ||
+ | * Retrieve groups [implement only where required/ | ||
+ | * | ||
+ | * Set getGroups capability when implemented | ||
+ | * | ||
+ | * @param | ||
+ | * @param | ||
+ | * @return | ||
+ | */ | ||
+ | //public function retrieveGroups($start = 0, $limit = 0) { | ||
+ | // FIXME implement | ||
+ | // return array(); | ||
+ | //} | ||
+ | |||
+ | /** | ||
+ | * Return case sensitivity of the backend | ||
+ | * | ||
+ | * When your backend is caseinsensitive (eg. you can login with USER and | ||
+ | * user) then you need to overwrite this method and return false | ||
+ | * | ||
+ | * @return bool | ||
+ | */ | ||
+ | public function isCaseSensitive() { | ||
+ | return true; | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Sanitize a given username | ||
+ | * | ||
+ | * This function is applied to any user name that is given to | ||
+ | * the backend and should also be applied to any user name within | ||
+ | * the backend before returning it somewhere. | ||
+ | * | ||
+ | * This should be used to enforce username restrictions. | ||
+ | * | ||
+ | * @param string $user username | ||
+ | * @return string the cleaned username | ||
+ | */ | ||
+ | public function cleanUser($user) { | ||
+ | return $user; | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Sanitize a given groupname | ||
+ | * | ||
+ | * This function is applied to any groupname that is given to | ||
+ | * the backend and should also be applied to any groupname within | ||
+ | * the backend before returning it somewhere. | ||
+ | * | ||
+ | * This should be used to enforce groupname restrictions. | ||
+ | * | ||
+ | * Groupnames are to be passed without a leading ' | ||
+ | * | ||
+ | * @param | ||
+ | * @return string the cleaned groupname | ||
+ | */ | ||
+ | public function cleanGroup($group) { | ||
+ | return $group; | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Check Session Cache validity [implement only where required/ | ||
+ | * | ||
+ | * DokuWiki caches user info in the user's session for the timespan defined | ||
+ | * in $conf[' | ||
+ | * | ||
+ | * This makes sure slow authentication backends do not slow down DokuWiki. | ||
+ | * This also means that changes to the user database will not be reflected | ||
+ | * on currently logged in users. | ||
+ | * | ||
+ | * To accommodate for this, the user manager plugin will touch a reference | ||
+ | * file whenever a change is submitted. This function compares the filetime | ||
+ | * of this reference file with the time stored in the session. | ||
+ | * | ||
+ | * This reference file mechanism does not reflect changes done directly in | ||
+ | * the backend' | ||
+ | * | ||
+ | * Fast backends might want to return always false, to force rechecks on | ||
+ | * each page load. Others might want to use their own checking here. If | ||
+ | * unsure, do not override. | ||
+ | * | ||
+ | * @param | ||
+ | * @return bool | ||
+ | */ | ||
+ | //public function useSessionCache($user) { | ||
+ | // FIXME implement | ||
+ | //} | ||
+ | } | ||
+ | |||
+ | // vim: | ||
+ | </ | ||
+ | |||
===== Discussion ===== | ===== Discussion ===== | ||
Line 461: | Line 786: | ||
* yann: edit the file conf/ | * yann: edit the file conf/ | ||
* Better yet, use the group Members as is defined in the table groups in the PunBB MySQL database. | * Better yet, use the group Members as is defined in the table groups in the PunBB MySQL database. | ||
+ | |||
+ | * With Dokuwiki 2012-10-13 Adora Belle, the auth stoped working with following error:< | ||
+ | * To fix it, you need to change the line 102 from // |