|
@@ 216-236 (lines=21) @@
|
| 213 |
|
} |
| 214 |
|
} |
| 215 |
|
|
| 216 |
|
public function testUserCanAuthenticate( $username ) { |
| 217 |
|
$username = User::getCanonicalName( $username, 'usable' ); |
| 218 |
|
if ( $username === false ) { |
| 219 |
|
return false; |
| 220 |
|
} |
| 221 |
|
|
| 222 |
|
// We have to check every domain, because at least LdapAuthentication |
| 223 |
|
// interprets AuthPlugin::userExists() as applying only to the current |
| 224 |
|
// domain. |
| 225 |
|
$curDomain = $this->auth->getDomain(); |
| 226 |
|
$domains = $this->auth->domainList() ?: [ '' ]; |
| 227 |
|
foreach ( $domains as $domain ) { |
| 228 |
|
$this->auth->setDomain( $domain ); |
| 229 |
|
if ( $this->testUserCanAuthenticateInternal( User::newFromName( $username ) ) ) { |
| 230 |
|
$this->auth->setDomain( $curDomain ); |
| 231 |
|
return true; |
| 232 |
|
} |
| 233 |
|
} |
| 234 |
|
$this->auth->setDomain( $curDomain ); |
| 235 |
|
return false; |
| 236 |
|
} |
| 237 |
|
|
| 238 |
|
/** |
| 239 |
|
* @see self::testUserCanAuthenticate |
|
@@ 281-301 (lines=21) @@
|
| 278 |
|
} |
| 279 |
|
} |
| 280 |
|
|
| 281 |
|
public function testUserExists( $username, $flags = User::READ_NORMAL ) { |
| 282 |
|
$username = User::getCanonicalName( $username, 'usable' ); |
| 283 |
|
if ( $username === false ) { |
| 284 |
|
return false; |
| 285 |
|
} |
| 286 |
|
|
| 287 |
|
// We have to check every domain, because at least LdapAuthentication |
| 288 |
|
// interprets AuthPlugin::userExists() as applying only to the current |
| 289 |
|
// domain. |
| 290 |
|
$curDomain = $this->auth->getDomain(); |
| 291 |
|
$domains = $this->auth->domainList() ?: [ '' ]; |
| 292 |
|
foreach ( $domains as $domain ) { |
| 293 |
|
$this->auth->setDomain( $domain ); |
| 294 |
|
if ( $this->auth->userExists( $username ) ) { |
| 295 |
|
$this->auth->setDomain( $curDomain ); |
| 296 |
|
return true; |
| 297 |
|
} |
| 298 |
|
} |
| 299 |
|
$this->auth->setDomain( $curDomain ); |
| 300 |
|
return false; |
| 301 |
|
} |
| 302 |
|
|
| 303 |
|
public function providerAllowsPropertyChange( $property ) { |
| 304 |
|
// No way to know the domain, just hope the provider handles that. |