LDAP groupOfNames : auth and enrol consistency

LDAP groupOfNames : auth and enrol consistency

by Yves Roy -
Number of replies: 1
The combination of auth/ldap and enrol/ldap can be very useful in the context of a large university. Here, we use eDirectory and its groupOfNames logic necessitates a few modifications because, in order to combine auth/ldap and enrol/ldap, you have to set the user's idnumber to its dn.

/moodle/auth/ldap/lib.php
Line 130 says:
$result[$key]=addslashes(stripslashes(utf8_decode($user_entry[0][strtolower($value)][0])));
But, if you choose an attribute like dn, the return value is not an array and you will get only the first character. You can rewrite it as:
if (!is_array($user_entry[0][strtolower($value)])) {
 $result[$key]=addslashes(stripslashes(utf8_decode($user_entry[0][strtolower($value)])));
} else {
 $result[$key]=addslashes(stripslashes(utf8_decode($user_entry[0][strtolower($value)][0])));
}

Line 383 says :
execute_sql('CREATE TEMPORARY TABLE ' . $CFG->prefix .'extuser (idnumber VARCHAR(12), PRIMARY KEY (idnumber)) TYPE=MyISAM',false);
In order to be consistent with moodlelib.php limits (line 2287), it should be VARCHAR(64).

This value (64) may not be enough in some directories. Why not fix it to 100, like the value for the courses idnumber?
Average of ratings: -
In reply to Yves Roy

Re: LDAP groupOfNames : auth and enrol consistency

by Martín Langhoff -
Both issues fixed in MOODLE_15_STABLE and HEAD. Thanks for the heads up - patches (in unified diff format) welcome!

idnumber, if it's going to be holding DNs, will have to become huge, so I'm holding off a bit. We usually wait for a new release for DB upgrades.