DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:authmysql:drupal

Drupal

Configuration for authMySQL Auth plugin for authentication with Drupal, which let's do:

  • Only basic authentication
  • No user modification/adding. 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.

Tested on Drupal version 5.1.

Configuration

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

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

conf/local.protected.php
<?php
/**
 * Drupal configuration for MySQL Auth Plugin
 * See https://www.dokuwiki.org/plugin:authmysql:drupal for details and explanation
 */
//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['plugin']['authmysql']['server']   = '';
$conf['plugin']['authmysql']['user']     = '';
$conf['plugin']['authmysql']['password'] = '';
$conf['plugin']['authmysql']['database'] = '';
 
//used to check user passwords
$conf['plugin']['authmysql']['checkPass']   = "SELECT pass FROM drupal_users WHERE name='%{user}'";
 
//used to get user information
$conf['plugin']['authmysql']['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['plugin']['authmysql']['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'";
plugin/authmysql/drupal.txt · Last modified: 2013-02-10 14:19 by Klap-in