LDAP authentication and enrollment

LDAP authentication and enrollment

by Greg Rodenhiser -
Number of replies: 1
I have a current Moodle 1.7 install on Redhat Linux. I have the service up and running and using LDAP authentication without issues. Now I am attempting to run an eval for my employer. I would like to have a series of students and instructors configured in their respective courses. However a few problems come up:

1.) If the user has not yet logged in how do I enroll them in a course? Moodle is unaware of their account until they login for the first time. I know I can do an upload user feed, but even then it seems Moodle will not allow me to use the user account until the first time they login.

2.) I got by the problem in question one by setting up the user course information in the upload user CSV file (instead of using the enrollment CSV file). However, if the course is created non enrollable (we definately do not want any student to have the ability to enroll themselves in any course they wish to, we want to handle this all via the enrollment CSV file), the user CSV file cannot enroll a user. So in order to use the user CSV file to enroll a user in their courses, I'd have to make the course enrollable.

So basically, what is the best way to configure Moodle to use LDAP for authentication, but have a user already enrolled in their respective courses and in their respective role in said courses (student, teacher, etc)? All this to be done before the first time they login (as it seems that Moodle really needs the user to login first before being able to do anything).

Thanks!!
Average of ratings: -
In reply to Greg Rodenhiser

Re: LDAP authentication and enrollment

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
If you are using LDAP authentication, you can use the auth_ldap_sync_users.php script that is located at .../moodle/auth/ldap. This script creates all the LDAP users not present in Moodle and deletes all the Moodle users that are no longer in the LDAP server (provided they were using LDAP authentication, the script doesn't touch non-LDAP users).

This way you can have all of your users in Moodle easily and enroll, assign roles or do whatever you want with them.

By the way, courses don't need to be enrollable in order to enrol users via CSV file upload (at least not up to Moodle version 1.6.x, so I'd be quite surprised this has changed in 1.7.x).

Saludos. Iñaki.
Average of ratings: Useful (1)