Improve message texts and scalabillity

Always start uppercase and don't use count() function until we've got a more scalable implementation in the LdapConnection.

refs #9630
This commit is contained in:
Matthias Jentsch 2015-07-16 13:38:35 +02:00
parent da5ceb0e73
commit ffe672c252
1 changed files with 8 additions and 8 deletions

View File

@ -376,19 +376,18 @@ class LdapUserBackend extends LdapRepository implements UserBackendInterface, In
try { try {
$res = $this->select()->fetchRow(); $res = $this->select()->fetchRow();
} catch (LdapException $e) { } catch (LdapException $e) {
throw new AuthenticationException('Connection not possible.', $e); throw new AuthenticationException('Connection not possible', $e);
} }
$result->write('Connection possible.'); $result->write('Searching for: ' . sprintf(
$msg = sprintf( 'objectClass "%s" in DN "%s" (Filter: %s)',
'objects with objectClass "%s" in DN "%s" (Filter: %s)',
$this->userClass, $this->userClass,
$this->baseDn ?: $this->ds->getDn(), $this->baseDn ?: $this->ds->getDn(),
$this->filter ?: 'None' $this->filter ?: 'None'
); ));
if ($res === false) { if ($res === false) {
throw new AuthenticationException('No ' . $msg . 'found'); throw new AuthenticationException('Error, no users found in backend');
} }
$result->write($msg . ' exist'); $result->write('Users found in backend');
if (! isset($res->user_name)) { if (! isset($res->user_name)) {
throw new AuthenticationException( throw new AuthenticationException(
'UserNameAttribute "%s" not existing in objectClass "%s"', 'UserNameAttribute "%s" not existing in objectClass "%s"',
@ -397,7 +396,8 @@ class LdapUserBackend extends LdapRepository implements UserBackendInterface, In
); );
} }
$result->write('User count: ' . $this->select()->count()); // (mj) don't do this until we have a more scalable count() implementation
// $result->write('User count: ' . $this->select()->count());
} catch (AuthenticationException $e) { } catch (AuthenticationException $e) {
if (($previous = $e->getPrevious()) !== null) { if (($previous = $e->getPrevious()) !== null) {
$result->error($previous->getMessage()); $result->error($previous->getMessage());