DokuWiki

It's better when it's simple

User Tools

Site Tools


auth:mysql_moodle

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

auth:mysql_moodle [2011-05-28 21:03] (current)
79.215.141.55 created
Line 1: Line 1:
 +[[mysql|« MySQL Authentification Backend]]
  
 +====== Moodle elearning system ======
 +User authentication with the [[http://moodle.org|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:
 +
 +<code php>
 +$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}'";                                                                              
 +</code>
 +
 +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 
 +<code php>$conf['superuser'] = '@admin';</code> 
 +to 
 +<code php>$conf['superuser'] = 'SUPERUSER';</code>
 +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