DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:authmysql:smf

Simple Machines Forum

Configuration for authMySQL Auth plugin to authenticate with Simple Machines Forum, which let's do:

  • Only basic authentication
  • No user modification/adding. This assumes that all user/group accounts will be created and maintained through Simple Machines Forum.

Basic auth module

You can use simple auth module to login to your DokuWiki with SMF database. Just download one of smf.class.php files below (for you SMF version) and put it into inc/auth/ directory of you DokuWiki installation and then select smf as authtype in DokuWiki settings manager.

Features:

  • Full support of usernames with non-ASCII symbols (if you use utf8 encoding in your SMF database)
  • Allow to login by email (like in SMF)
  • Full support of user's groups
  • Support of getting user's list at Doku admin page with simple filter
  • Doesn't support any operations, which modify SMF database

Requirements:

  • SMF 1.x or SMF 2.x
  • UTF-8 database in SMF (may be it will work with other encodings if you change appropriate line in module, but I can not guarantee it)

This module simply authenticate DokuWiki users in SMF database and it doesn't allow to modify or add users and groups.

For SMF 1.x:

For SMF 2.x:

Coming soon…

Malamut 2010/10/16 11:57

Old method

SMF 2.x:

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

$conf['superuser'] = '@Administrator';
conf/local.protected.php
<?php
/**
 * Simple Machine Forum configuration for MySQL Auth Plugin
 * See https://www.dokuwiki.org/plugin:authmysql:smf for details and explanation
 */
 
$conf['plugin']['authmysql']['checkPass']   = "SELECT passwd
                                               FROM smf_members
                                               WHERE member_Name = '%{user}'
                                               AND passwd = SHA1(concat(LOWER(member_Name), '%{pass}'))";
 
$conf['plugin']['authmysql']['getUserInfo'] = "SELECT passwd AS pass, real_Name AS name, email_Address AS mail
                                               FROM smf_members
                                               WHERE member_Name = '%{user}'";
 
$conf['plugin']['authmysql']['getGroups']   = "SELECT replace(group_Name, ' ', '_') as `group`
                                              FROM smf_membergroups g, smf_members m
                                              WHERE m.member_Name = '%{user}'
                                              AND ( ( FIND_IN_SET(g.id_group, m.additional_groups) ) or ( m.id_group = g.id_group ) )";
 
$conf['plugin']['authmysql']['getUsers']    = "SELECT DISTINCT member_Name AS user
                                              FROM smf_members AS u
                                              LEFT JOIN smf_membergroups AS g ON u.ID_GROUP=g.ID_GROUP";
$conf['plugin']['authmysql']['FilterLogin'] = "u.member_Name LIKE '%{user}'";
$conf['plugin']['authmysql']['FilterName']  = "u.real_Name LIKE '%{name}'";
$conf['plugin']['authmysql']['FilterEmail'] = "u.email_Address LIKE '%{email}'";
$conf['plugin']['authmysql']['FilterGroup'] = "g.group_Name LIKE '%{group}'";
$conf['plugin']['authmysql']['SortOrder']   = "ORDER BY u.member_Name";

nadams 2012/07/20 05:06

SMF 1.x:

:!: You can't use non-ASCII logins with this method and this method doesn't consider additional user groups.

User authentication with Simple Machines Forum.

Tested with SMF 1.1.4 and DokuWiki version 2007-06-26b.

This assumes that all user accounts will be created and maintained by SMF. For user groups it selects only the first user group.

For admin account add the memberName from your *_members table in conf/local.php:

$conf['superuser']='%smfadmin_memberName'

Or (I found this easier) simply tell DokuWiki that you want people in the SMF Administrator group to be DokuWiki 'superusers' instead. — Chris Rowson 2008-02-16 00:35

$conf['superuser'] = '@Administrator';

Also change the table prefix in the queries below (here it is smfforum). If you don't have a table prefix omit everything up to and including the underscore.

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

conf/local.protected.php
<?php
/**
 * Simple Machine Forum configuration for MySQL Auth Plugin
 * See https://www.dokuwiki.org/plugin:authmysql:smf for details and explanation
 */
$conf['plugin']['authmysql']['checkPass']   = "SELECT passwd
                                               FROM smfforum_members
                                               WHERE memberName = '%{user}'
                                               AND passwd = SHA1(concat(LOWER('%{user}'), '%{pass}'))";
 
$conf['plugin']['authmysql']['getUserInfo'] = "SELECT passwd AS pass, realName AS name, emailAddress AS mail
                                               FROM smfforum_members
                                               WHERE memberName = '%{user}'";
 
$conf['plugin']['authmysql']['getGroups']   = "SELECT groupName as `group`
                                               FROM smfforum_membergroups g, smfforum_members u
                                               WHERE u.memberName = '%{user}'
                                               AND u.ID_GROUP = g.ID_GROUP";
 
$conf['plugin']['authmysql']['getUsers']    = "SELECT DISTINCT memberName AS user
                                               FROM smfforum_members AS u
                                               LEFT JOIN smfforum_membergroups AS g ON u.ID_GROUP=g.ID_GROUP";
$conf['plugin']['authmysql']['FilterLogin'] = "u.memberName LIKE '%{user}'";
$conf['plugin']['authmysql']['FilterName']  = "u.realName LIKE '%{name}'";
$conf['plugin']['authmysql']['FilterEmail'] = "u.emailAddress LIKE '%{email}'";
$conf['plugin']['authmysql']['FilterGroup'] = "g.groupName LIKE '%{group}'";
$conf['plugin']['authmysql']['SortOrder']   = "ORDER BY u.memberName";

Mykhaylo Sorochan 2007-12-08 22:35

Old community auth Module

:!: You can't use non-ASCII logins with this module (at least in 0.3 version)

A community-developed Auth module for SMF and Dokuwiki integration, see this thread for download/discussion.

/**
 * SMF authentication backend for Dokuwiki v 2009-07-17
 *
 * @license    Creative Commons BY
 * @author     David Frank <bitinn@gmail.com>
 * @version    0.3
 * @base       for Dokuwiki 2009-02-14 + SMF 1.1.10
 *
 * Provide as an alternative to smf.class.php
 * Does not introduce new trustExternal() to verify user,
 * merely extends a few funtions from mysql.class.php
 *
 * Pros:
 *  allow user registration within dokuwiki
 *  allow full user managerment within dokuwiki
 *  dokuwiki handles login, avoid old smf_api
 *  (which causes extensive amount of frustration)
 *
 * Cons:
 *  one-click login integration will be difficult
 *  (currently users have to login wiki/forum seperately)
 *  user deletion within dokuwiki is not complete
 *  (see additional comment on delUserRefs)
 */
plugin/authmysql/smf.txt · Last modified: 2013-03-16 16:51 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