DokuWiki

It's better when it's simple

User Tools

Site Tools


auth:mysql_moodle

« MySQL Authentification Backend

Moodle elearning system

User authentication with the Moodle elearning system (tested with dokuwiki-2011-05-25 and moodle-2.0.3)

The Users will be created and maintained through moodle.

First you have to modify the mysql.conf.php like this:

$conf['authtype'] = "mysql";
$conf['useacl']    = 1;              // turn on Access Control Lists
 
$conf['auth']['mysql']['server']   = 'localhost';
$conf['auth']['mysql']['user']     = 'moodle_user';
$conf['auth']['mysql']['password'] = 'password';
$conf['auth']['mysql']['database'] = 'moodle';
 
$conf['auth']['mysql']['forwardClearPass'] = 1;
 
$conf['auth']['mysql']['checkPass']   = "SELECT password AS pass
                                        FROM mdl_user
                                        WHERE username='%{user}'
                                        AND password=MD5('%{pass}TOKEN')";
 
$conf['auth']['mysql']['getUserInfo'] = "SELECT password AS pass, username AS name, email AS mail
                                        FROM mdl_user
                                        WHERE username='%{user}'";
 
$conf['auth']['mysql']['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.

auth/mysql_moodle.txt · Last modified: 2011-05-28 21:03 by 79.215.141.55

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki