Fix "Call to a member function getUID() on boolean" in Crypt

This commit is contained in:
Joas Schilling 2015-10-22 11:46:37 +02:00
parent c50bbb8cde
commit e0a56317fa

View file

@ -53,7 +53,7 @@ class Crypt {
*/
private $logger;
/**
* @var IUser
* @var string
*/
private $user;
/**
@ -73,7 +73,7 @@ class Crypt {
*/
public function __construct(ILogger $logger, IUserSession $userSession, IConfig $config) {
$this->logger = $logger;
$this->user = $userSession && $userSession->isLoggedIn() ? $userSession->getUser() : false;
$this->user = $userSession && $userSession->isLoggedIn() ? $userSession->getUser()->getUID() : '"no user given"';
$this->config = $config;
$this->supportedKeyFormats = ['hash', 'password'];
}
@ -89,7 +89,7 @@ class Crypt {
$res = $this->getOpenSSLPKey();
if (!$res) {
$log->error("Encryption Library couldn't generate users key-pair for {$this->user->getUID()}",
$log->error("Encryption Library couldn't generate users key-pair for {$this->user}",
['app' => 'encryption']);
if (openssl_error_string()) {
@ -108,7 +108,7 @@ class Crypt {
'privateKey' => $privateKey
];
}
$log->error('Encryption library couldn\'t export users private key, please check your servers OpenSSL configuration.' . $this->user->getUID(),
$log->error('Encryption library couldn\'t export users private key, please check your servers OpenSSL configuration.' . $this->user,
['app' => 'encryption']);
if (openssl_error_string()) {
$log->error('Encryption Library:' . openssl_error_string(),