Append domain in auto-created users from LDAP login
Created by: godlike64
Hello,
I had previously set up Gitlab 7.7 (.1 I think) and I configured it to authenticate against my LDAP directory. A thing to note here is that I'm running a custom LDAP scheme (not any of the known, widely used ones), so I could accomodate more easily multiple domains. This same LDAP tree is authenticating several other services (mail-related, Jabber, etc).
So today I bumped into a particular issue: I have two users whose mail address is the same, except for the domain part (let's call them [email protected] and [email protected]). Whichever user logged in first, got the 'user' entry created in the users table, and its corresponding LDAP mapping in identities. However, when the other user wanted to login, he got an error similar to #8530 (closed).
So I updated to 7.8 to see if it was fixed, and indeed it is. Now the first user that logs in gets its username set as 'user1', and the second one, 'user2'. While this fixes the problem nicely, it might result in a bit of awkwardness for other people. Namely, when I search for a user to add to a project/group, I get his name (which is correctly gotten from the LDAP, but in many cases like this, might be the same name across several domains) and his username, both of which do not tell me much if I don't already know which is which.
So my suggestion is, instead of appending an incremental integer to the username, to append the domain name. I don't know If dots cannot be used here, but it could be something like
user-examplecom
or
user.example.com
Let me know if this is feasible/possible/desired/unwanted/risky
Cheers