Need help! I'm trying to setup a DokuWiki, just like Lussumo's, where you need to login to be able to post...
The default for DokuWiki is to be able to post without logging in, can anyone give me step by step instructions on how to make a superuser and make it so you can login?
Thanks!!!!!
0 • •
Comments
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •Haven't really had a proper play with Dokuwiki yet. It's on my list.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •Caveats:
I set up so DokuWiki checks if I'm logged in to Vanilla via "People", and if so, to log in automatically. I didn't want to set extra cookies beyond the session, nor allow login/logout by anything but Vanilla.
!! This may or may not work for you, but hopefully it gives a starting point. !!
!! Including People gives all sorts of crazy PHP warnings. On Dreamhost they're inconsequential, as output buffering is turned off, but this may be a problem on your host. !!
UPDATE:
re-tested with a fresh install of Vanilla and Dokuwiki and works as expected.
added line '$conf['useacl'] = 1;' to conf/local.php.
added file conf/acl.auth.php.
added opening and closing php tags to files for clarity.
corrected error ($Configuration['DATABASE_NAME'] should be $Configuration['DATABASE_USER']) inc/auth/vanilla.class.php, line 69.
UDATE II:
Minor changes to inc/auth/vanilla.class.php
All that said, here goes:
file: [dokuwiki base directory]/conf/local.php
Add the following lines at the outset of the file:
/* Include Vanilla's People. Dokuwiki will overwrite these variables.
* NOTE: this must be the first line in the file */
@include(DOKU_CONF.'local.protected.php');
Also include the following:
$conf['useacl'] = 1;
$conf['authtype'] = 'vanilla';
/* Grab DB info from Vanilla's conf */
$conf['auth']['mysql']['server'] = $Configuration['DATABASE_HOST'];
$conf['auth']['mysql']['user'] = $Configuration['DATABASE_NAME'];
$conf['auth']['mysql']['password'] = $Configuration['DATABASE_PASSWORD'];
$conf['auth']['mysql']['database'] = $Configuration['DATABASE_NAME'];
file: [dokuwiki base directory]/conf/local.protected.php
(NOTE: make sure to set the proper VANILLA_ROOT!!)
<?php
/* Integrating w/vanilla give all sorts inconsequential errors. For
* debugging purposes, comment out the next two lines */
error_reporting(0);
ini_set("display_errors", 0);
if(!defined('VANILLA_ROOT')) define('VANILLA_ROOT', '/path/to/your/vanilla/install');
require_once VANILLA_ROOT.'appg/settings.php';
require_once VANILLA_ROOT.'appg/init_people.php';
?>php
file: [dokuwiki base directory/conf/acl.auth.php
<?php/* allows all users to view wiki pages */
* @ALL 1
/* grant admin user all rights */
* @Administrator 16
/* grant member create & edit rights */
* @Member 8
?>
file: [dokuwiki base directory]/inc/auth/vanilla.class.php
<?php
/**
* Vanilla Backend
*
* Adapted from Andreas Gohr's <andi@splitbrain.org> PunBB backend
* by Brent Shultz <bshultz@gmail.com>
*/
require_once DOKU_INC.'inc/auth/mysql.class.php';
class auth_vanilla extends auth_mysql {
/**
* Constructor.
*
* Sets additional capabilities and config strings
*/
function auth_vanilla(){
global $Configuration;
$this->cando['external'] = true;
$conf['passcrypt'] = 'md5';
$conf['auth']['mysql']['checkPass'] = "SELECT u.Password AS pass
FROM ${db_prefix}User AS u, ${db_prefix}Role AS g
WHERE u.RoleID = g.RoleID
AND u.Name = '%{user}'
AND g.Name = ('Member' OR 'Moderator' OR 'Administrator')";
$conf['auth']['mysql']['getUserInfo'] = "SELECT Password AS pass, u.Name AS name, Email AS mail,
UserID as id, g.Name as group
FROM ${db_prefix}User AS u, ${db_prefix}Role AS g
WHERE u.RoleID = g.RoleID
AND u.Name = '%{user}'";
$conf['auth']['mysql']['getGroups'] = "SELECT g.Name as `group`
FROM ${db_prefix}User AS u, ${db_prefix}Role AS g
WHERE u.RoleID = g.RoleID
AND u.Name = '%{user}'";
$conf['auth']['mysql']['getUsers'] = "SELECT DISTINCT u.Name AS user
FROM ${db_prefix}User AS u, ${db_prefix}Role AS g
WHERE u.RoleID = g.RoleID";
$conf['auth']['mysql']['FilterLogin'] = "u.Name LIKE '%{user}'";
$conf['auth']['mysql']['FilterName'] = "u.Name LIKE '%{name}'";
$conf['auth']['mysql']['FilterEmail'] = "u.Email LIKE '%{email}'";
$conf['auth']['mysql']['FilterGroup'] = "g.Name LIKE '%{group}'";
$conf['auth']['mysql']['SortOrder'] = "ORDER BY u.Name";
$conf['auth']['mysql']['getGroupID'] = "SELECT RoleID AS id FROM ${db_prefix}Role WHERE Name='%{group}'";
$conf['auth']['mysql']['TablesToLock']= array("${db_prefix}User", "${db_prefix}User AS u",
"${db_prefix}Role", "${db_prefix}Role AS g");
$conf['auth']['mysql']['debug'] = 0;
// call mysql constructor
$this->auth_mysql();
}
function trustExternal($user,$pass,$sticky=false){
global $Configuration;
global $Context;
global $USERINFO;
global $conf;
global $lang;
$sticky ? $sticky = true : $sticky = false; //sanity check
if ($Context->Session->UserID > 0) {
mysql_connect($Configuration['DATABASE_HOST'], $Configuration['DATABASE_USER'], $Configuration['DATABASE_PASSWORD']);
if ($CookieUserID == '') $CookieUserID = $Context->Session->UserID;
mysql_select_db($Configuration['DATABASE_NAME']);
$result = mysql_query('SELECT u.Name as Name, u.Password as Password, u.Email as Email, u.RoleID, g.RoleID, g.Name as GroupName FROM LUM_User as u, LUM_Role as g WHERE UserID='.$CookieUserID.' AND u.RoleID = g.RoleID');
while ($row = mysql_fetch_object($result)) {
$USERINFO['pass'] = $row->Password;
$USERINFO['name'] = $row->Name;
$USERINFO['mail'] = $row->Email;
$USERINFO['grps'] = array($row->GroupName);
$_SERVER['REMOTE_USER'] = $row->Name;
$_SESSION[DOKU_COOKIE]['auth']['user'] = $row->Name;
$_SESSION[DOKU_COOKIE]['auth']['info'] = $USERINFO;
}
mysql_free_result($result);
return true;
}
// to be sure
auth_logoff();
return false;
}
}
?>
Comments, suggestions, corrections, etc. are welcomed.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •OpenSourceCMS
a site that allows you to try out several packages for blogs, forums, cms, e-commerce, e-learning and others, including full admin capabilities for all, without having to install them in your own server.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •Also, did you set the path to Vanilla in conf/local.protected.php on the following line?
if(!defined('VANILLA_ROOT')) define('VANILLA_ROOT', '/path/to/your/vanilla/install');Not setting that line, or setting it improperly, will result in a blank wiki.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •$conf['useacl'] = 1;I accidentally omitted that my first go round.
Also omitted from my initial posting, was conf/acl.auth.php
<?php/* allows all users to view wiki pages */
* @ALL 1
/* grant admin user all rights */
* @Administrator 16
/* grant member create & edit rights */
* @Member 8
?>
That should make it all good to go.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •$CookieUserID = @$_COOKIE[$Configuration['COOKIE_USER_KEY']];$VerificationKey = @$_COOKIE[$Configuration['COOKIE_VERIFICATION_KEY']];
I initially had issues that would not set the cookie user & verification key via $Context if the login was not persistent (ie. session only). I figured it out, but forgot to remove those lines.
I've eliminated those in my post above, and replaced:
if (($CookieUserID != '' && $VerificationKey != '')||($Context->Session->UserID > 0)) {with
if ($Context->Session->UserID > 0) {It does the same exact thing, just dumps extraneous code.
$_SERVER['REMOTE_USER'] is how DokuWiki stores usernames. $row->Name; is that info from the database.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •The only line you should need to change is the path to Vanilla.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •I'm just testing this, but it doesn't work! :-( I'm logged in at Vanilla, but DokuWiki thinks, I'm not! And if I try to login in at DokuWikis login screen, the screen allways just reloads! :-(
Tiggr
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •