PurposeTo authenticate DokuWiki users against your UBB.threads database.
DemoAs can be seen on my site, the
VFDCwiki is integrated with the
VFDC Forums.
BackgroundFrom the
DokuWiki website:
DokuWiki is a standards compliant, simple to use Wiki, mainly aimed at creating documentation of any kind. It is targeted at developer teams, workgroups and small companies. It has a simple but powerful syntax which makes sure the datafiles remain readable outside the Wiki and eases the creation of structured texts. All data is stored in plain text files – no database is required.
DokuWiki can use a variety of
authentication backends for logging users in and out. Since it supports a
MySQL backend, you can use your UBB.threads database to authenticate your Wiki users.
Changes to conf/local.phpChanges are required to the DokuWiki configuration which can be done by either manually editing the conf/local.php file, or by using the Admin panel of your installation. For each step I will be showing the change required within conf/local.php.
1. Enable
ACL (Access Control Lists) for your Wiki installation.
2. Enable MySQL as your desired authentication type.
$conf['authtype'] = "mysql";
3. Require the configuration file for your MySQL authentication.
require_once ("mysql.conf.php");
By default, you may only have a conf/mysql.conf.php.example file. Just copy it to conf/mysql.conf.php since we'll be modifying it in the steps ahead.
4. If you want all of your UBB.t Administrators to be "superuser" in your Wiki, then add the following:
$conf['superuser'] = '@Administrators';
5. DokuWiki can allow users to register, resend their password, and manage their own profile. I disable all of these actions, forcing my users to go through the forums for that functionality. You can disable these actions as follows:
$conf['disableactions'] = 'register,resendpwd,profile';
The only user-level actions that are allowed are login and logout, which is the bare minimum required to track users in the system.
Changes to conf/mysql.conf.phpThis file contains all configuration settings required by the MySQL backend. If you copied this file from the default example file, then just change the settings mentioned below. Otherwise, just include the below in the abovementioned file.
Note: If you use a different UBB.t table prefix to "ubbt_" then just replace as required.
1. Populate the main database settings below. The server, user, password and (name of) database should be the same as your UBB.threads configuration.
$conf['auth']['mysql']['server'] = 'localhost';
$conf['auth']['mysql']['user'] = 'your_user';
$conf['auth']['mysql']['password'] = 'your_password';
$conf['auth']['mysql']['database'] = 'your_database';
$conf['auth']['mysql']['forwardClearPass'] = 0;
$conf['auth']['mysql']['TablesToLock']= array("ubbt_USERS", "ubbt_USERS AS u","ubbt_GROUPS", "ubbt_GROUPS AS g", "ubbt_USER_GROUPS", "ubbt_USER_GROUPS AS ug");
2. The settings below are for the MySQL user authentication.
$conf['auth']['mysql']['checkPass'] =
"SELECT USER_PASSWORD AS pass
FROM ubbt_USERS
WHERE USER_LOGIN_NAME='%{user}'";
$conf['auth']['mysql']['getUserInfo'] =
"SELECT USER_PASSWORD AS pass,
USER_DISPLAY_NAME AS name,
USER_REGISTRATION_EMAIL AS mail
FROM ubbt_USERS
WHERE USER_LOGIN_NAME='%{user}'";
$conf['auth']['mysql']['getGroups'] =
"SELECT GROUP_NAME AS `group`
FROM ubbt_GROUPS g, ubbt_USERS u, ubbt_USER_GROUPS ug
WHERE u.USER_ID = ug.USER_ID
AND g.GROUP_ID = ug.GROUP_ID
AND u.USER_LOGIN_NAME='%{user}'";
and that about does it! If you've done everything correctly, and more importantly, if I haven't forgotten anything

then you should be able to login to your wiki using your forum username and password!
But, you won't be able to edit anything yet (unless you're the admin) until you setup the ACL based on your Forum users or groups. See the next section!
Changes to conf/acl.auth.phpDokuWiki's ACL allows you to grant all sorts of access levels to users and/or groups down to the namespace or page. You may decide that you want your wiki editable by all your users, or just your moderators, or only members from a custom group you created in your forums.
I defined access levels for my forum Moderators and Users groups. I also have a custom group called Authors.
My conf/acl.auth.php looks like this:
* @ALL 1
* @user 8
* @admin 255
vf5:* @Authors 16
vf5:* @Moderators 8
vf5:* @Users 1
The first three lines in the above ACL are most likely your default settings. The admin group can do everything, (local) users can edit, create and upload, and everyone else (ALL) gets read-only. You could probably delete or comment the @user and @admin lines since you'll no longer be using the default local authentication.
The last three lines, however, use the group names from your forums. In the example above, my forum groups have only been given access to the namespace called "vf5". In this namespace, it gives all my forum Users read-only access, Moderators can read, edit, create, and upload, and Authors can do everything Moderators can with the addition of delete.
I use the Authors group mainly for forum users who aren't Moderators but are willing to contribute to the Wiki.
In case you're wondering why the @Administrators group doesn't appear in my ACL, it's because I've already defined this group to be a "superuser" (see step 4 in Changes to conf/local.php).
Please refer to DokuWiki
ACL documentation for a more detailed information.
Of course, my Wiki is not as "open" as others, and I pretty much control which forum users can edit it. So, the above just serves as an example of how to control access levels using groups from your UBB.t forums, and not a suggestion of how
you should run your Wiki!

If anyone is brave enough to try this out, let me know how it goes for you!