CS: Fix DbUserBackend

refs #4641
This commit is contained in:
Marius Hein 2013-08-30 10:30:19 +02:00
parent 7c8252a983
commit c77a48ff1f
1 changed files with 7 additions and 6 deletions

View File

@ -33,6 +33,7 @@ use \stdClass;
use \Zend_Config; use \Zend_Config;
use \Zend_Db; use \Zend_Db;
use \Zend_Db_Adapter_Abstract; use \Zend_Db_Adapter_Abstract;
use \Zend_Db_Statement_Exception;
use \Icinga\Application\DbAdapterFactory; use \Icinga\Application\DbAdapterFactory;
use \Icinga\Exception\ProgrammingError; use \Icinga\Exception\ProgrammingError;
use \Icinga\User; use \Icinga\User;
@ -135,7 +136,7 @@ class DbUserBackend implements UserBackend
/** /**
* Check if the user identified by the given credentials is available * Check if the user identified by the given credentials is available
* *
* @param Credential $credential * @param Credential $credential Credential to find a user in the database
* *
* @return boolean True when the username is known and currently active. * @return boolean True when the username is known and currently active.
*/ */
@ -152,7 +153,7 @@ class DbUserBackend implements UserBackend
/** /**
* Authenticate a user with the given credentials * Authenticate a user with the given credentials
* *
* @param Credential $credential * @param Credential $credential Credential to authenticate
* *
* @return User|null The authenticated user or Null. * @return User|null The authenticated user or Null.
*/ */
@ -167,7 +168,7 @@ class DbUserBackend implements UserBackend
$salt = $this->getUserSalt($credential->getUsername()); $salt = $this->getUserSalt($credential->getUsername());
} catch (Exception $e) { } catch (Exception $e) {
Logger::error( Logger::error(
'Could not create salt for user %s. Exception was thrown: %s', 'Could not fetch salt from database for user %s. Exception was thrown: %s',
$credential->getUsername(), $credential->getUsername(),
$e->getMessage() $e->getMessage()
); );
@ -239,7 +240,7 @@ class DbUserBackend implements UserBackend
return $this->createUserFromResult($res); return $this->createUserFromResult($res);
} }
return null; return null;
} catch (\Zend_Db_Statement_Exception $exc) { } catch (Zend_Db_Statement_Exception $exc) {
Logger::error('Could not fetch users from db : %s ', $exc->getMessage()); Logger::error('Could not fetch users from db : %s ', $exc->getMessage());
return null; return null;
} }
@ -248,7 +249,7 @@ class DbUserBackend implements UserBackend
/** /**
* Create a new instance of User from a query result * Create a new instance of User from a query result
* *
* @param stdClass $resultRow * @param stdClass $resultRow Result object from database
* *
* @return User The created instance of User. * @return User The created instance of User.
*/ */