It's better when it's simple

User Tools

Site Tools


Unclassified News Board

Configuration for authMySQL Auth plugin to connect to UNB, which let's do:

  • Only basic authentication
  • No user modification/adding. You can maintain your users via UNB, via the DokuWiki interface is not implemented here.

Please forgive me if this code doesn't work for you, it was my first real attempt at working with MySQL. It works for me, and I am confident that it is not going to nuke your DB or anything.

Tested on UNB 20080531-dev, though I think it will work with any version that supports AUTH via MySQL.

Password type

Please note that you needs to change the password hashing method in DokuWiki or UNB because their default methods differ. DokuWiki supports the custom UNB's kmd5 method, you can set it with the config passcrypt.


Use the Config Manager or add it to the conf/local.protected.php to store the config protected.

 * UNB configuration for MySQL Auth Plugin
 * See for details and explanation
// Set to UNB's hashing method 
$conf['passcrypt'] = "kmd5";
// Activate MySQL auth plugin
$conf['authtype'] = "mysql";
// Grant or Deny access to the wiki:
$conf['plugin']['authmysql']['checkPass']   = "SELECT Password AS pass
                                               FROM unb_users
                                               WHERE Name='%{user}'";
// Returns table with info for one user:
$conf['plugin']['authmysql']['getUserInfo'] = "SELECT Password AS pass, Name AS name, EMail AS mail
                                               FROM unb_users
                                               WHERE Name='%{user}'";
// Get all groups user is a member of:
$conf['plugin']['authmysql']['getGroups']   = "SELECT gn.Name as `group`
					      FROM unb_groupmembers gm, unb_users u, unb_groupnames gn
					      WHERE u.ID = gm.User
				      	      AND gn.ID = gm.Group
				      	      AND u.Name='%{user}'";
// This statement should return a table containing all user login names
$conf['plugin']['authmysql']['getUsers']    = "SELECT DISTINCT u.Name AS 'user'
                                               FROM unb_users AS u 
                                               LEFT JOIN unb_groupmembers AS gm ON u.ID=gm.User
                                               LEFT JOIN unb_groupnames AS gn ON gm.Group=gn.ID";
$conf['plugin']['authmysql']['FilterLogin'] = "u.Name LIKE '%{user}'";
$conf['plugin']['authmysql']['FilterName']  = "u.Name LIKE '%{name}'";
$conf['plugin']['authmysql']['FilterEmail'] = "u.Email LIKE '%{email}'";
$conf['plugin']['authmysql']['FilterGroup'] = "gn.Name LIKE '%{group}'";
$conf['plugin']['authmysql']['SortOrder']   = "ORDER BY u.Name";
// This statement should return the database index of a given user name.
$conf['plugin']['authmysql']['getUserID']   = "SELECT ID AS id
                                               FROM unb_users
                                               WHERE Name='%{user}'";

NFGman 2008/08/10 10:29

plugin/authmysql/unb.txt · Last modified: 2013-02-10 00:45 by Klap-in

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki