So we have a Moodle server at our school that is connected to our LDAP server for user authentication. This works great for us as it provides for easy integration with out other systems that use this form of authentication (FinalSite web site / WebHelpDesk/Apple ODstructure).
One issue we had though was that certain data was being entered at the time of user creation and other fields we just left blank. This was fine until we needed to get information out of Moodle and into our school’s information system (SIS), particularly student emails.
The issue was that while the Moodle database has an ID for each user this ID didn’t match anything in our SIS or LDAP directory (Apple OD). The ID assigned to students in the LDAP/OD system is based on one generated in or SIS… so we needed to get that ID into Moodle.
I was able to map the correct field from LDAP (uidNumber) to the ID Number field in Moodle and set the “Update local” bit to “On every login”, but this would only update the ID on the next user login and I needed to have it sooner.
What I needed to do was to run a sync of the Moodle database to the LDAP server to have this newly mapped value brought into the system… but how to do that.
Here you go:
- Via Terminal navigate to /var/www/html/auth/ldap
- You will need to run “auth_ldap_sync_users.php”. This script must be run in this manner.
This will add any users entered in LDAP that are not already in the Moodle system (WARNING: You may get users from LDAP you don’t want in Moodle). It will also add any of the newly mapped attributes to those users already in the system.
This simple process saved me a TON of work… hopefully it will help you too.