Remove Firefly III's ability to encrypt data in the database.

This commit is contained in:
James Cole
2019-01-31 19:56:09 +01:00
parent d56bd85328
commit 4307bf3b83
26 changed files with 166 additions and 742 deletions

View File

@@ -143,49 +143,6 @@ class Account extends Model
return $name;
}
/**
* @param $value
*
* @return string
*
* @throws FireflyException
*/
public function getIbanAttribute($value): string
{
if ('' === (string)$value) {
return '';
}
try {
$result = Crypt::decrypt($value);
} catch (DecryptException $e) {
Log::error($e->getMessage());
Log::error($e->getTraceAsString());
throw new FireflyException('Cannot decrypt value "' . $value . '" for account #' . $this->id);
}
if (null === $result) {
return '';
}
return $result;
}
/**
* @codeCoverageIgnore
*
* @param $value
*
* @return string
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/
public function getNameAttribute($value): ?string
{
if ($this->encrypted) {
return Crypt::decrypt($value);
}
return $value;
}
/**
* Returns the opening balance.
*
@@ -237,31 +194,6 @@ class Account extends Model
$query->whereIn('account_types.type', $types);
}
/**
* @param $value
*
* @codeCoverageIgnore
* @throws \Illuminate\Contracts\Encryption\EncryptException
*/
public function setIbanAttribute($value): void
{
$this->attributes['iban'] = Crypt::encrypt($value);
}
/**
* @codeCoverageIgnore
*
* @param $value
*
* @throws \Illuminate\Contracts\Encryption\EncryptException
*/
public function setNameAttribute($value): void
{
$encrypt = config('firefly.encryption');
$this->attributes['name'] = $encrypt ? Crypt::encrypt($value) : $value;
$this->attributes['encrypted'] = $encrypt;
}
/**
* @codeCoverageIgnore
*