DokuWiki

It's better when it's simple

User Tools

Site Tools


Sidebar

Translations of this page?:

Learn about DokuWiki

Advanced Use

Corporate Use

Our Community


Follow us on Facebook, Twitter and other social networks.

auth:mysql_smf

« MySQL Authentification Backend

Authorization with 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…

MalamutMalamut

2010/10/16 11:57

Old method

SMF 2.x:

$conf['superuser'] = '@Administrator';
$conf['auth']['mysql']['checkPass']   = "SELECT passwd
                                         FROM smf_members
                                         WHERE member_Name = '%{user}'
                                         AND passwd = SHA1(concat(LOWER(member_Name), '%{pass}'))";
 
$conf['auth']['mysql']['getUserInfo'] = "SELECT passwd AS pass, real_Name AS name, email_Address AS mail
                                         FROM smf_members
                                         WHERE member_Name = '%{user}'";
 
$conf['auth']['mysql']['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['auth']['mysql']['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['auth']['mysql']['FilterLogin'] = "u.member_Name LIKE '%{user}'";
$conf['auth']['mysql']['FilterName']  = "u.real_Name LIKE '%{name}'";
$conf['auth']['mysql']['FilterEmail'] = "u.email_Address LIKE '%{email}'";
$conf['auth']['mysql']['FilterGroup'] = "g.group_Name LIKE '%{group}'";
$conf['auth']['mysql']['SortOrder']   = "ORDER BY u.member_Name";

nadamsnadams

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.

$conf['auth']['mysql']['checkPass']   = "SELECT passwd
                                         FROM smfforum_members
                                         WHERE memberName = '%{user}'
                                         AND passwd = SHA1(concat(LOWER('%{user}'), '%{pass}'))";
 
$conf['auth']['mysql']['getUserInfo'] = "SELECT passwd AS pass, realName AS name, emailAddress AS mail
                                         FROM smfforum_members
                                         WHERE memberName = '%{user}'";
 
$conf['auth']['mysql']['getGroups']   = "SELECT groupName as `group`
                                        FROM smfforum_membergroups g, smfforum_members u
                                        WHERE u.memberName = '%{user}'
                                        AND u.ID_GROUP = g.ID_GROUP";
 
$conf['auth']['mysql']['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['auth']['mysql']['FilterLogin'] = "u.memberName LIKE '%{user}'";
$conf['auth']['mysql']['FilterName']  = "u.realName LIKE '%{name}'";
$conf['auth']['mysql']['FilterEmail'] = "u.emailAddress LIKE '%{email}'";
$conf['auth']['mysql']['FilterGroup'] = "g.groupName LIKE '%{group}'";
$conf['auth']['mysql']['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)
 */
auth/mysql_smf.txt · Last modified: 2012-07-20 05:07 by nadams