Monday, January 12, 2015

The slight annoyance of the ldap configuration

We synched a moodle instance with a LDAP server.  All the account creation - synching happen from their ldap server to our moodle instance.  Great.  No problem.  It's all good.  Simplify things for our end users.  Allow them to use their school network sign on  to log into moodle (via ldap)  - sweet.   When first time users attempt to log into moodle, an account is created for them using the credentials provided. 

A *problem showed itself .  An ldap account synching with moodle that does not the email field completed.  There is a group of middle schoolers taking a course on the moodle, their ldap accounts do not include email. Our customer does not allow emails for middle school students. 

I had a question from my customer the other day "James - we have some accounts created in moodle all enrolled in a course and ready to go, but they need emails.  Please advise".  I advised previously, to fill the email with dummy addresses on the ldap side - and push them to the moodle account.  This did not happen, so i ended up adding the dummy emails to the accounts in moodle.  A couple other useful thoughts around this.

1 - I should put a default in the DB table/field in the mdl_user table.  If nothing is send from the LDAP record, then the table default would provide that, I would not have to *post fill any account.

2 - We set up out LDAP configuration to never look for updates on the moodle side.  That seemed like a bad idea to start.  Only updates coming from one direction.

3 - I should not put a default value/string in the DB email users table.  If I do, I create a maintenance point in my instance and have to remember to change that after an upgrade.  Plus, the LDAP record pushing to moodle may have a empty string or even a NULL value that would be written to the account - *over ridding the default value provided.

4 - The moodle edit profile form requires that a unique email be specified.  This is a problem if you have a lot of emails that need to be filled, like an entire 5th grade class.  
5 - Fill the email address with the same dummy email - by updating the records in the table directly.  There is no table rule on mdl_user, that says "you must provide a unique value" in the email.  That constraint exists in the HTML/PHP form/code.


No comments:

Post a Comment