DokuWiki

It's better when it's simple

User Tools

Site Tools


Sidebar

Translations of this page?:

Learn about DokuWiki

Advanced Use

Corporate Use

Our Community


Follow us on Facebook, Twitter and other social networks.

auth:mysql_fudforum

« MySQL Authentification Backend

FUDforum

User authentication with FUDforum.

Tested on FUDforum version 2.7.6.

This assumes that all user accounts will be created and maintained through FUDforum. :!: Newer FUDforum Versions uses fud26 as table prefix.

<?php
/**
 * Options to configure for a FUDforum database
 * http://fudforum.org/
 */
 
/**
 * Turn off registration on DokuWiki
 */
$conf['openregister'] = 0;
 
/**
 * Set the signature for all users
 *
 * This signature will link to the user's FUDforum profile. To make this work
 * correctly, add the following line to the conf/interwiki.conf file. Be sure
 * to replace "forum.example.org" with the hostname for your FUDforum 
 * installation. You may need to modify the path to index.php if you installed
 * FUDforum in a directory other than root. This also assumes you have 
 * PATH_INFO style URLs turned on in FUDforum.
 *
 *   user      http://forum.example.org/index.php/u/{PATH}/
 *
 * If you are not using PATH_INFO style URLs in FUDforum, use the following 
 * format in interwiki.conf:
 *
 *   user      http://forum.example.org/index.php?t=usrinfo&id={URL}
 *
 * Note that this relies on the getUserInfo query below that stores the user
 * id in the `mail` field instead of the actual e-mail address.
 */
$conf['signature'] = '//[[user>@MAIL@|@NAME@]] @DATE@//';
 
/**
 * Database connection parameters; change these for your environment
 */
$conf['auth']['mysql']['server']   = '';
$conf['auth']['mysql']['user']     = '';
$conf['auth']['mysql']['password'] = '';
$conf['auth']['mysql']['database'] = '';
 
/**
 * Send password in clear text to database
 */
$conf['auth']['mysql']['forwardClearPass'] = 1;
 
/**
 * Authenticate user by checking password
 */
$conf['auth']['mysql']['checkPass']= "SELECT passwd as `pass`
                                      FROM fud_users
                                      WHERE login='%{user}' 
                                      AND passwd=MD5('%{pass}')";
 
/**
 * Get user info
 *
 * Note the use of "id AS `mail`". Instead of retrieving the user's email
 * address, I'm getting the ID for use with the user's DokuWiki signature
 * (see note on $conf['signature'] above). If you do not wish to use this
 * signature and would rather get the e-mail address, use "email" instead of
 * "id" in the query below.
 */
$conf['auth']['mysql']['getUserInfo'] = "SELECT passwd AS `pass`, login AS `name`, id AS `mail`
                                         FROM fud_users
                                         WHERE login='%{user}'";
 
/**
 * Get groups to which user belongs
 *
 * Note the use of the UNION. This allows all registered users to be a member
 * of the default group (as defined in $conf['defaultgroup']) without the 
 * need to create a new group in FUDforum. Other groups may be created in 
 * FUDforum for "admin," etc.
 */
$conf['auth']['mysql']['getGroups'] = "SELECT fud_groups.name AS 'group'
                                       FROM fud_groups, fud_users, fud_group_members
                                       WHERE fud_users.id = fud_group_members.user_id
                                       AND fud_groups.id = fud_group_members.group_id
                                       AND fud_users.login='%{user}'
                                       UNION 
                                       SELECT '" . $conf['defaultgroup'] . "' as `group`";
?>

Ben Ramsey 2007-03-12 16:39

auth/mysql_fudforum.txt · Last modified: 2011-03-22 17:25 by Aleksandr