mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Remove Firefly III's ability to encrypt data in the database.
This commit is contained in:
@@ -39,7 +39,6 @@ use Illuminate\Support\Facades\Facade;
|
||||
* @method string negative(string $amount)
|
||||
* @method string|null opposite(string $amount = null)
|
||||
* @method int phpBytes(string $string)
|
||||
* @method tryDecrypt($value)
|
||||
* @method string positive(string $amount)
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
@@ -107,9 +107,6 @@ trait AugumentData
|
||||
$categoryName = $transaction->transaction_journal_category_name;
|
||||
$categoryId = (int)$transaction->transaction_journal_category_id;
|
||||
}
|
||||
if (0 !== $categoryId) {
|
||||
$categoryName = app('steam')->tryDecrypt($categoryName);
|
||||
}
|
||||
|
||||
// if not set, set to zero:
|
||||
if (!isset($sum[$categoryId][$currencyId])) {
|
||||
@@ -559,9 +556,6 @@ trait AugumentData
|
||||
$budgetName = $transaction->transaction_journal_budget_name;
|
||||
$budgetId = (int)$transaction->transaction_journal_budget_id;
|
||||
}
|
||||
if (0 !== $budgetId) {
|
||||
$budgetName = app('steam')->tryDecrypt($budgetName);
|
||||
}
|
||||
|
||||
// if not set, set to zero:
|
||||
if (!isset($sum[$budgetId][$currencyId])) {
|
||||
@@ -627,9 +621,6 @@ trait AugumentData
|
||||
$categoryName = $transaction->transaction_journal_category_name;
|
||||
$categoryId = (int)$transaction->transaction_journal_category_id;
|
||||
}
|
||||
if (0 !== $categoryId) {
|
||||
$categoryName = app('steam')->tryDecrypt($categoryName);
|
||||
}
|
||||
|
||||
// if not set, set to zero:
|
||||
if (!isset($sum[$categoryId][$currencyId])) {
|
||||
|
@@ -63,12 +63,12 @@ class Modifier
|
||||
$res = true;
|
||||
switch ($modifier['type']) {
|
||||
case 'source':
|
||||
$name = app('steam')->tryDecrypt($transaction->account_name);
|
||||
$name = $transaction->account_name;
|
||||
$res = self::stringCompare($name, $modifier['value']);
|
||||
Log::debug(sprintf('Source is %s? %s', $modifier['value'], var_export($res, true)));
|
||||
break;
|
||||
case 'destination':
|
||||
$name = app('steam')->tryDecrypt($transaction->opposing_account_name);
|
||||
$name = $transaction->opposing_account_name;
|
||||
$res = self::stringCompare($name, $modifier['value']);
|
||||
Log::debug(sprintf('Destination is %s? %s', $modifier['value'], var_export($res, true)));
|
||||
break;
|
||||
@@ -81,7 +81,7 @@ class Modifier
|
||||
Log::debug(sprintf('Budget is %s? %s', $modifier['value'], var_export($res, true)));
|
||||
break;
|
||||
case 'bill':
|
||||
$name = app('steam')->tryDecrypt($transaction->bill_name);
|
||||
$name = $transaction->bill_name;
|
||||
$res = self::stringCompare($name, $modifier['value']);
|
||||
Log::debug(sprintf('Bill is %s? %s', $modifier['value'], var_export($res, true)));
|
||||
break;
|
||||
@@ -171,11 +171,11 @@ class Modifier
|
||||
{
|
||||
$journalBudget = '';
|
||||
if (null !== $transaction->transaction_journal_budget_name) {
|
||||
$journalBudget = app('steam')->tryDecrypt($transaction->transaction_journal_budget_name);
|
||||
$journalBudget = $transaction->transaction_journal_budget_name;
|
||||
}
|
||||
$transactionBudget = '';
|
||||
if (null !== $transaction->transaction_budget_name) {
|
||||
$journalBudget = app('steam')->tryDecrypt($transaction->transaction_budget_name);
|
||||
$journalBudget = $transaction->transaction_budget_name;
|
||||
}
|
||||
|
||||
return self::stringCompare($journalBudget, $search) || self::stringCompare($transactionBudget, $search);
|
||||
@@ -191,11 +191,11 @@ class Modifier
|
||||
{
|
||||
$journalCategory = '';
|
||||
if (null !== $transaction->transaction_journal_category_name) {
|
||||
$journalCategory = app('steam')->tryDecrypt($transaction->transaction_journal_category_name);
|
||||
$journalCategory = $transaction->transaction_journal_category_name;
|
||||
}
|
||||
$transactionCategory = '';
|
||||
if (null !== $transaction->transaction_category_name) {
|
||||
$journalCategory = app('steam')->tryDecrypt($transaction->transaction_category_name);
|
||||
$journalCategory = $transaction->transaction_category_name;
|
||||
}
|
||||
|
||||
return self::stringCompare($journalCategory, $search) || self::stringCompare($transactionCategory, $search);
|
||||
|
@@ -377,22 +377,6 @@ class Steam
|
||||
return trim($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $isEncrypted
|
||||
* @param $value
|
||||
*
|
||||
* @return string
|
||||
* @throws \Illuminate\Contracts\Encryption\DecryptException
|
||||
*/
|
||||
public function decrypt(int $isEncrypted, string $value): string
|
||||
{
|
||||
if (1 === $isEncrypted) {
|
||||
return Crypt::decrypt($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $accounts
|
||||
*
|
||||
@@ -490,19 +474,4 @@ class Steam
|
||||
return $amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function tryDecrypt($value)
|
||||
{
|
||||
try {
|
||||
$value = Crypt::decrypt($value);
|
||||
} catch (DecryptException $e) {
|
||||
// do not care.
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
@@ -131,13 +131,13 @@ class Transaction extends Twig_Extension
|
||||
$txt = '';
|
||||
// journal has a budget:
|
||||
if (null !== $transaction->transaction_journal_budget_id) {
|
||||
$name = app('steam')->tryDecrypt($transaction->transaction_journal_budget_name);
|
||||
$name = $transaction->transaction_journal_budget_name;
|
||||
$txt = sprintf('<a href="%s" title="%s">%s</a>', route('budgets.show', [$transaction->transaction_journal_budget_id]), $name, $name);
|
||||
}
|
||||
|
||||
// transaction has a budget
|
||||
if (null !== $transaction->transaction_budget_id && '' === $txt) {
|
||||
$name = app('steam')->tryDecrypt($transaction->transaction_budget_name);
|
||||
$name = $transaction->transaction_budget_name;
|
||||
$txt = sprintf('<a href="%s" title="%s">%s</a>', route('budgets.show', [$transaction->transaction_budget_id]), $name, $name);
|
||||
}
|
||||
|
||||
@@ -169,13 +169,13 @@ class Transaction extends Twig_Extension
|
||||
$txt = '';
|
||||
// journal has a category:
|
||||
if (null !== $transaction->transaction_journal_category_id) {
|
||||
$name = app('steam')->tryDecrypt($transaction->transaction_journal_category_name);
|
||||
$name = $transaction->transaction_journal_category_name;
|
||||
$txt = sprintf('<a href="%s" title="%s">%s</a>', route('categories.show', [$transaction->transaction_journal_category_id]), $name, $name);
|
||||
}
|
||||
|
||||
// transaction has a category:
|
||||
if (null !== $transaction->transaction_category_id && '' === $txt) {
|
||||
$name = app('steam')->tryDecrypt($transaction->transaction_category_name);
|
||||
$name = $transaction->transaction_category_name;
|
||||
$txt = sprintf('<a href="%s" title="%s">%s</a>', route('categories.show', [$transaction->transaction_category_id]), $name, $name);
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ class Transaction extends Twig_Extension
|
||||
return '—';
|
||||
}
|
||||
|
||||
$name = app('steam')->tryDecrypt($transaction->account_name);
|
||||
$name = $transaction->account_name;
|
||||
$iban = $transaction->account_iban;
|
||||
$transactionId = (int)$transaction->account_id;
|
||||
$type = $transaction->account_type;
|
||||
@@ -255,7 +255,7 @@ class Transaction extends Twig_Extension
|
||||
|
||||
return '';
|
||||
}
|
||||
$name = app('steam')->tryDecrypt($other->name);
|
||||
$name = $other->name;
|
||||
$transactionId = $other->account_id;
|
||||
$type = $other->type;
|
||||
}
|
||||
@@ -384,7 +384,7 @@ class Transaction extends Twig_Extension
|
||||
}
|
||||
|
||||
// if the amount is negative, assume that the current account (the one in $transaction) is indeed the source account.
|
||||
$name = app('steam')->tryDecrypt($transaction->account_name);
|
||||
$name = $transaction->account_name;
|
||||
$transactionId = (int)$transaction->account_id;
|
||||
$type = $transaction->account_type;
|
||||
$iban = $transaction->account_iban;
|
||||
@@ -408,7 +408,7 @@ class Transaction extends Twig_Extension
|
||||
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
|
||||
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
|
||||
->first(['transactions.account_id', 'accounts.encrypted', 'accounts.name', 'account_types.type']);
|
||||
$name = app('steam')->tryDecrypt($other->name);
|
||||
$name = $other->name;
|
||||
$transactionId = $other->account_id;
|
||||
$type = $other->type;
|
||||
}
|
||||
|
Reference in New Issue
Block a user