DokuWiki

It's better when it's simple

User Tools

Site Tools


auth:mysql_drupal

« MySQL Authentification Backend

Drupal

User authentication with Drupal.

Tested on Drupal version 5.1. Paste this into: local.php

User accounts will be created and maintained through Drupal, any number of user roles can also be created and used for ACL in DokuWiki.

The user role wiki_admin should be created and it's members will automatically become DokuWiki superusers.

the database prefix in this example is drupal_ which needs to be replaced with you own. E.g. drupal_users would become myprefix_users.

//general settings
$conf['useacl']    = 1;              //turn on Access Control Lists
$conf['authtype']  = 'mysql';        //use MySQL back-end for Drupal
$conf['passcrypt'] = 'md5';          //md5 hash is default password has for Drupal
$conf['superuser'] = '@wiki_admin';  //Drupal role that will be DokuWiki superuser
 
//server settings
$conf['auth']['mysql']['server']   = '';
$conf['auth']['mysql']['user'] = '';
$conf['auth']['mysql']['password'] = '';
$conf['auth']['mysql']['database'] = '';
 
//used to check user passwords
$conf['auth']['mysql']['checkPass']   = "SELECT pass FROM drupal_users WHERE name='%{user}'";
 
//used to get user information
$conf['auth']['mysql']['getUserInfo'] = "SELECT pass, name, mail FROM drupal_users WHERE name='%{user}'";
 
//this will get a users usergroups. Note all logged in users will be also be automatically part of the 
//'authenticated user' group. This is useful to add ACL rules such as only logged in users can edit content.
//This can easily be done basing rules in the DokuWiki ACL Management on the 'authenticated user' group.
$conf['auth']['mysql']['getGroups']   = "SELECT DISTINCT r.name AS 'group'
                                         FROM drupal_users AS u, drupal_users_roles AS ur, drupal_role AS r
                                         WHERE (u.uid = ur.uid AND r.rid = ur.rid AND u.name = '%{user}')
                                         OR r.name = 'authenticated user'";
auth/mysql_drupal.txt · Last modified: 2011-03-22 17:28 by Aleksandr

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