DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:authmysql:moodle

Moodle elearning system

Configuration for authMySQL Auth plugin to authenticate with Moodle elearning system, which let's do:

  • Only basic authentication
  • No user modification/adding. This assumes that all user/group accounts will be created and maintained through Moodle.

Tested with dokuwiki-2011-05-25 and moodle-2.0.3

Configuration

Use the Config Manager or add it to the conf/local.protected.php to store the config protected.

conf/local.protected.php
<?php
/**
 * Moodle elearning system configuration for MySQL Auth Plugin
 * See https://www.dokuwiki.org/plugin:authmysql:moodle for details and explanation
 */
 
$conf['authtype'] = "mysql";
$conf['useacl']   = 1;              // turn on Access Control Lists
 
$conf['plugin']['authmysql']['server']   = 'localhost';
$conf['plugin']['authmysql']['user']     = 'moodle_user';
$conf['plugin']['authmysql']['password'] = 'password';
$conf['plugin']['authmysql']['database'] = 'moodle';
 
$conf['plugin']['authmysql']['forwardClearPass'] = 1;
 
$conf['plugin']['authmysql']['checkPass']   = 
    "SELECT password AS pass
     FROM mdl_user
     WHERE username='%{user}'
     AND password=MD5('%{pass}TOKEN')";
 
$conf['plugin']['authmysql']['getUserInfo'] = 
    "SELECT password AS pass, username AS name, email AS mail
     FROM mdl_user
     WHERE username='%{user}'";
 
$conf['plugin']['authmysql']['getGroups']   = 
    "SELECT shortname AS `group`
     FROM mdl_role g, mdl_role_assignments ug ,mdl_user u
     WHERE ug.userid = u.id
       AND g.id = ug.roleid
       AND u.username='%{user}'";

The string TOKEN in the checkpass statement has to be replaced with the token your moodle instance uses for securing passwords.

Next step is to modify the local.php file. Change the line

$conf['superuser'] = '@admin';

to

$conf['superuser'] = 'SUPERUSER';

where SUPERUSER is the name of your moodlesuperuser.

Finally log in as superuser in dokuwiki and modify the ACL:

Group rights Comment
@ALL none not absolutely necessary depends on your setup
SUPERUSER all
@manager all
@student read, write, (create)
@editingteacher read, write, create
@user read (write, create)

Of course you can do it like it fits for you, but this is how its works for me.

plugin/authmysql/moodle.txt · Last modified: 2013-03-16 21:46 by Klap-in