UBB.Dev
Posted By: Myke [7.2.2] DokuWiki authenticating against UBB.t - 09/13/2007 12:47 PM
Purpose
To authenticate DokuWiki users against your UBB.threads database.

Demo
As can be seen on my site, the VFDCwiki is integrated with the VFDC Forums.

Background
From 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.php
Changes 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.

PHP Code
$conf['useacl'] = 1; 
2. Enable MySQL as your desired authentication type.

PHP Code
$conf['authtype'] = "mysql"; 
3. Require the configuration file for your MySQL authentication.

PHP Code
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:
PHP Code
$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:
PHP Code
$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.php
This 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.
PHP Code
$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.
PHP Code
$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 smile 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.php
DokuWiki'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:

Code
*               @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! smile

If anyone is brave enough to try this out, let me know how it goes for you!
Thanks for providing this, it looks like it'll be really useful for those UBB's that use a wiki smile
Thank you Myke! thumbsup
If we want the wiki to be private, with no access unless you are a member, is that pretty easy?
Read the acl docs, not too bad. smile
i really think we should have a ubbthreads api, where more than just user_auth is gleaned from.

i had to fool around with auto login / user creation of a threads user, based upon a foreign system and it just screamed for such an api.

i know Rick mentioned it to me at some point, but i'd love to see it.

possible cookie sharing, stylesheet sharing and on and on.

makes integration easier and even more tight in the end.
Sir Dude want to play around with my site to see if you can get my board hooked into my mediawiki?
:points: she's cheating on me with an older man! :snicker:™
:flex:™
wink

Originally Posted by sirdude
i really think we should have a ubbthreads api, where more than just user_auth is gleaned from.

i had to fool around with auto login / user creation of a threads user, based upon a foreign system and it just screamed for such an api.

i know Rick mentioned it to me at some point, but i'd love to see it.

possible cookie sharing, stylesheet sharing and on and on.

makes integration easier and even more tight in the end.


and header/footer/headerinsert smile

yes please smile
hehe.. i don't know if you are stalking me tonite or it's the other way around, but i seem to be posting either just before or just after you laugh
He appreciates my breasts
Originally Posted by sirdude
hehe.. i don't know if you are stalking me tonite or it's the other way around, but i seem to be posting either just before or just after you laugh


smile

I need to integrate another script into threads (my tng genealogy software) - someone integrated some other forum with the app using the api from them, a ubbt api may make it possible for me to get it done too smile
Originally Posted by sirdude
:flex:™
! thats my :flex:&trade!!

Originally Posted by AllenAyres
I need to integrate another script into threads (my tng genealogy software) - someone integrated some other forum with the app using the api from them, a ubbt api may make it possible for me to get it done too smile
That'd be nice, I wouldn't necessarily have to fork it off to do any sort of auth against its db... Though to add features and styles how i want them it's going to have to anyway :x...
dokuwiki is probably all I need - the feature comparison with the others is close enough, UNLESS I end up needing a mysql backend smile

tng - not written the best (could really use some sort of template system to start) but appears to be the best of its kind out there right now.
yeh, TNG is much better than TUFAT; but definately needs some work...
Originally Posted by AshtarRose
Sir Dude want to play around with my site to see if you can get my board hooked into my mediawiki?


i've actually looked deeper into it and find that mediawiki has tons of features and all that, but for a ubbthreads board, it's overkill.

dokuwiki and pmwiki would be the two choices i'd go with.

and the more i look @ dokuwiki, the better i like it. i much prefer their ACL and just the coding style in general.

the only issue is hooking in the styles in a more automatic way, but any wiki you choose would have that problem.
Posted By: driv Re: [7.2.2] DokuWiki authenticating against UBB.t - 10/29/2007 10:30 PM
Originally Posted by Myke
If anyone is brave enough to try this out, let me know how it goes for you!


Hi Myke,
Just wanted to let you know that this works well and couldn't have come at a better time for me smile

Thanks a lot laugh
Cheers, and glad to hear that it worked! smile
Just confirming that this still works with UBB.threads 7.5.3.
Does this work still with UBB.threads Version7.6.1
© UBB.Developers