DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:authdrupal7

authdrupal7 Plugin

Compatible with DokuWiki

  • 2017-02-19 "Frusterick Manners" yes
  • 2016-06-26 "Elenor Of Tsort" yes
  • 2015-08-10 "Detritus" yes
  • 2014-09-29 "Hrun" yes

plugin Authenticate using Drupal 7 login credentials

Last updated on
2015-07-29
Provides
Auth
Repository
Source

Installation

:!: Note: Wrong use of some settings can make your wiki unreachable. Be sure to read the full documentation before installing/activating the plugin.

:!: External requirements: This plugin requires the following additional components that must be installed separately:

Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.

Usage

When using the plugin Dokuwiki will get the user and login information from a Drupal 7 database.

Users can login using their Drupal 7 login credentials. Registering and modifying users is not possible (and most likely will not be) as this functionality is provided by Drupal.
Dokuwiki will read user groups and memberships from the Drupal 7 database as well. Make sure you read the configuration instructions further below on this page.

Configuration and Settings

After installation and activation the plugin can be configured using the dokuwiki configuration page. Make sure you stick to the suggested order unless you know exactly what you do.

1. Plugin configuration

You will find an authdrupal7-section on your config page. Edit the following values:

  • server: this will most likely be localhost
  • user: mysql-username with at least reading access to the Drupal database
  • password
  • database: name of the drupal database on your mysql-server
  • charset: charset of the mysql-database
  • drupalPrefix: Prefix of your Drupal tables, e.g. mypre_, make sure it ends with an underscore
  • drupalRoot: Path to your Drupal installation, make sure it ends with an /

You have the possibility to change the SQL statements retrieving needed information. For most Drupal installations the default statements should work fine.

2. ACL settings

Dokuwiki will use the Drupal roles as usergroups. To get the correct permissions for your users you have to edit the ACL settings.

When granting permissions the user group names are replaced with Drupal role names. If you want to grant access to all Drupal users that are members of the role wiki use the user group name @wiki.

3. Authentication

Go to the authentication section of the configuration page.

  • Add at least one valid Drupal role or Drupal username to the superuser list e.g. @administrator. I highly recommend that you are part of this group as this will be necessary to access the administration section afterwards. :!: I highly recommend to keep @admin as well, so you can easily switch back to authplain.
  • You might add valid Drupal roles/usernames to the managers list.
  • Afterwards set the authentication method to authdrupal7.

About Drupal roles

I highly recommend that you create new Drupal roles for use in your Dokuwiki permissions. Doing this you will be able to grant or deny wiki permissions without affecting your drupal permission. Not neccessarily should every Drupal admin have superuser rights in Dokuwiki. Create and assign this roles using Drupal administration tools.

Configuration details

SQL statements (defaults)

checkPass

SQL statement for retrieving the password hash for a given user for downstream comparison.

SELECT pass FROM %{drupal_prefix}users WHERE name=\'%{user}\'

It is mandatory that the returned hash comes in a field named pass.

getUserInfo

SQL statement to retrieve information about a given user.

SELECT name, mail FROM %{drupal_prefix}users WHERE name=\'%{user}\'

It is mandatory that the returned values come in fields named name and mail.

getGroups

SQL statement to retrieve a given users role memberships.

SELECT roles.name FROM %{drupal_prefix}users users INNER JOIN %{drupal_prefix}users_roles userroles INNER JOIN %{drupal_prefix}role roles WHERE users.uid = userroles.uid AND roles.rid = userroles.rid AND users.name = \'%{user}\'

It is mandatory that the returned values come in a field named name.

getUserCount

SQL statement to retrieve the number of non-deactivated user accounts.

SELECT COUNT(*) AS num FROM %{drupal_prefix}users WHERE status = 1

It is mandatory that the returned value comes in a field named num.

Development

The authdrupal7 plugin widely bases on the authmysql plugin by Andreas Gohr.

Some changes were neccessary as Drupal uses some algorithms for hashing passwords that were not realizable using the authmysql plugin. The plugin includes these methods from the Drupal 7 installation.

Change Log

Bug Tracking

Discussion

plugin/authdrupal7.txt · Last modified: 2017-03-31 15:39 by 2a00:1398:9:fb03:2445:6b19:5b3d:318c