Translations of this page?:

PunBB Authentication backend

experimental This backend provides authentication against a PunBB forum installed on the same server. It provides single signon for the forum and the wiki by reusing PunBB's cookies.

Requirements

  • A recent PunBB forum installation
  • The forum needs to be on the same domain as the wiki
  • magic_quotes_gpc needs to be off

Configuration

The backend reuses your PunBB configuration. You just need to enable it and set is the PUN_ROOT define pointing to the installation dir of your PunBB forum. Just add it to your local.conf:

  $conf['useacl']  =1;
  $conf['authtype']='punbb';
  define('PUN_ROOT','/path/to/punbb/');

This path must be an absolute path, like /var/www/free.fr/2/8/mysite/punbb/ for example. And must end with a /!

FAQ

  • How do you define the admins in this way?

My account is in the admins group of the wiki, and in the administrators group of punbb, but I have no more access to DW admin though I am logged in successfully. I fulfill the requirements, and did the conf. forum is at forum.example.net, and wiki is at www.example.net/forum. ANy tip welcomed. Mathias 07-11-2006 02:18
⇒ On my installation I only changed the Dokuwiki Superuser group to @Administrators and that worked fbianco
=⇒It is not working for me, are there any other ways?

  • How do I define the admins with a french version of PunBB ?

Change the Dokuwiki Superuser group form @Administrators to @Administrateurs

  • How do I disable magic_quotes_gpc ?

Simply add this line into .htaccess file: php_value magic_quotes_gpc off
Since PHP5, magic_quotes_gpc is disabled by default and with PHP6, it won't be available at all. If your host lets you choose between PHP4 and PHP5, then go for PHP5.

  • Some username are not understand by Dokuwiki (Pérot became P�rot or Pérot)

Dokuwiki use UTF-8 and PunBB ISO8859-1, so this is just a character encoding problem. In order to get the right usernames, open /dokuwiki/inc/auth/punbb.class.php, find (l136 on v. 2007-06-26b) :

    if(isset($pun_user) && !$pun_user['is_guest']){
      // okay we're logged in - set the globals
      $USERINFO['pass'] = $pun_user['password'];
      $USERINFO['name'] = $pun_user['realname'];
      $USERINFO['mail'] = $pun_user['email'];
      $USERINFO['grps'] = array($pun_user['g_title']);
 
      $_SERVER['REMOTE_USER'] = $pun_user['username'];
      $_SESSION[DOKU_COOKIE]['auth']['user'] = $pun_user['username'];
      $_SESSION[DOKU_COOKIE]['auth']['info'] = $USERINFO;
      return true;
    }

And replace by :

    if(isset($pun_user) && !$pun_user['is_guest']){
      // okay we're logged in - set the globals
      $USERINFO['pass'] = $pun_user['password'];
      $USERINFO['name'] = utf8_encode($pun_user['realname']);
      $USERINFO['mail'] = $pun_user['email'];
      $USERINFO['grps'] = array($pun_user['g_title']);
 
      $_SERVER['REMOTE_USER'] = utf8_encode($pun_user['username']);
      $_SESSION[DOKU_COOKIE]['auth']['user'] = utf8_encode($pun_user['username']);
      $_SESSION[DOKU_COOKIE]['auth']['info'] = $USERINFO;
      return true;
    }

Maximilien Thiel 2007-11-13 - 11:00 UTC +01:00

  • As punbb 1.3 will support utf8, a better patch is :
          // okay we're logged in - set the globals
          $USERINFO['pass'] = $pun_user['password'];
          $USERINFO['name'] = preg_match('/^1\.2/',$pun_config['o_cur_version']) ? utf8_encode($pun_user['realname']) : $pun_user['realname'];
          $USERINFO['mail'] = $pun_user['email'];
          $USERINFO['grps'] = array($pun_user['g_title']);

    (only the $USERINFO['name'] line is changed)
    Stéphane Gully

Problems

  • I think there is a problem when you use dokuwiki's ACL : a regular member with appopriate rights under punbb can not edit a page though ACL seems properly configured (changes forbidden in : but allowed in :help: ). The problem may come from the fact dokuwiki has a “user” group while punbb has a “members” and this is not *always* correctly seen.
  • yann: edit the file conf/acl.auth.php, add there the group members (duplicate the line with “user”, and replace “user” by “members”.
  • Better yet, use the group Members as is defined in the table groups in the punbb mysql database.
 
wiki/auth/punbb.txt · Last modified: 2008/06/03 01:50 by 71.203.235.19
 
Imprint Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsTranslate