How to use multiple LDAP servers with Moodle 1.8

Re: How to use multiple LDAP servers with Moodle 1.8

by Michael Lynn -
Number of replies: 0

We are successfully using the clone script with Totara 2.7.6 (Moodle 2.7.9). It works really well.


A problem we have is that sometimes users have duplicate names in the different domains:

Example (names anonymised):

ldap - domain1\jsmith1 (Jonathan Smith)

ldap2 - domain2\jsmith1 (James Smith)

Jonathan Smith logs in and their account in Moodle is created.

When James Smith comes along their account isn't created in Moodle and they are logged in as Jonathan Smith.


This is because the username must be unique.

Question 1:

Am I right in saying that there is no way to map or modify the username created to include some other attribute e.g. country code in the Moodle username?

It might solve the problem if the username was generated with the country code as a prefix:

e.g. uk_jsmith1, us_jsmith1 etc.

We are using NTLM so the username is derived from SAMAccountName.


I can't see how we could even customise the authentication plugin because in auth.php in user_signup() $user->username is already populated with no access to other properties such as countrycode (mapped to c in the Active Directory attributes).