Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 1.9.5
-
Fix Version/s: DEV backlog
-
Component/s: Authentication
-
Labels:None
-
Difficulty:Easy
-
Affected Branches:MOODLE_19_STABLE
Description
We use the LDAP plugin to authenticate against a central LDAP server. The user data is copied from the LDAP to moodle. Unfortunately some data (in our case email) is provided in multi value fields. Currently moodle just uses the first entry - there is no way to choose a specific value.
The LDAP server we use provides two email values. The first one contains only the mailbox part (@foo.bar is missing) the second one is valid. So it would be nice, if there is a way to define which value to take.
My suggestion is to let the user (admin) define a pattern (for each mapping) the appropriate field must match. If no value matches the pattern, a default value should be used. If no data is entered in the new fields (pattern and default) the plugin performs its "normal" behaviour.
A first proposal for this feature can be found in the attached patch file.
Attachments
Activity
- All
- Comments
- History
- Activity
- Source
- Test Sessions
hello,
We are doing this here for the very same reasons
Our solution is to patch auth/cas/auth.php (and possibly auth/ldap/auth.php, that we don't use) to add
an extra parameter $getMulti=false to functions
function get_userinfo() {
function get_userinfo_asobj()
if true, the multivaluated attributes are returned as a CSV list to be parsed by caller (by a method similar to Peter's one)
Currently we use only it for nightly ldap sync of Moodle accounts
see attched patch