Thread:Extension talk:LDAP Authentication/Camelcased username is returned lowercased

Hello, FIRST, thank you for your wonderful extension.

We are using Mediawiki 0.18.0, LDAPAUTHVERSION=1.2e.

As for Clausekwis, we need $wgLDAPUseLocal because we want to grant certain rights to both specific internal (LDAP) and external (local) users.

There seems to be a problem with local accounts having capital characters in the middle of there username (like 'FirstMiddleLast'): such created users are "not registered" (when editing User:FirstMiddleLast), and we can't grant them any rights (Special:Permissions -> contributor not found).

Steps to reproduce:
 * 1) setup mediawiki + LDAP instance
 * 2) with $wgLDAPUseLocal=true
 * 3) with local 'Admin' user
 * 4) login as 'Admin/LdapDomain' (yes, /LdapDomain !)
 * 5) create local 'FirstMiddleLast' user
 * 6) list users (Special:UserList)
 * 7) click 'FirstMiddleLast'
 * 8) see 'User account "FirstMiddleLast" is not registered' warning

After some digging, I found that it only works when I am logged in with the 'local' domain ($wsDomain="local"). My question is: why, when looking for a given user, check for the domain of the currently logged in user ? And why not store the domain (user-specific) into the database ?

Here's a kind of stack trace to explain how I came to this conclusion:

includes/Article.php:function showMissingArticle: $user = User::newFromName( $rootPart, false /* allow IP users*/ ); includes/User.php:function newFromName( $name, $validate = 'valid' ): $name = self::getCanonicalName( $name, $validate ); includes/User.php:function getCanonicalName( $name, $validate = 'valid' ): global $wgAuth; $name = $wgAuth->getCanonicalName( $t->getText ); extensions/LdapAuthentication/LdapAuthentication.php: function getCanonicalName( $username ) { // ...    if ( isset( $_SESSION['wsDomain'] ) && 'local' != $_SESSION['wsDomain'] ) { $username = strtolower( $username ); }

The problem is that the username is returned lowercased (with the first character upcased) which should not happen for local accounts.

I believe there are no plans to support $wgLDAPUseLocal further, but I'll be glad to know a better way to have both LDAP and external (local) accounts.

As a workaround, we ended up imposing lowercased usernames (like 'first.middle.last').