Skip to content

Firefly III: a personal finances manager

Clean up code.

James Cole10597e3befd0
diff --git a/app/Ldap/AttributeHandler.php b/app/Ldap/AttributeHandler.php
new file mode 100644
index 0000000000..f8b025e6ef
--- /dev/null
+++ b/app/Ldap/AttributeHandler.php
@@ -0,0 +1,41 @@
+<?php
+/*
+ * AttributeHandler.php
+ * Copyright (c) 2021 [email protected]
+ *
+ * This file is part of Firefly III (https://github.com/firefly-iii).
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+namespace FireflyIII\Ldap;
+
+use FireflyIII\User as DatabaseUser;
+use LdapRecord\Models\OpenLDAP\User as LdapUser;
+
+/**
+ * Class AttributeHandler
+ */
+class AttributeHandler
+{
+ /**
+ * @param LdapUser $ldap
+ * @param DatabaseUser $database
+ */
+ public function handle(LdapUser $ldap, DatabaseUser $database)
+ {
+ $database->email = $ldap->getFirstAttribute('mail');
+ $database->save();
+ }
+}
\ No newline at end of file
diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepository.php b/app/Repositories/TransactionGroup/TransactionGroupRepository.php
index a49f5d531e..1f588c20b4 100644
--- a/app/Repositories/TransactionGroup/TransactionGroupRepository.php
+++ b/app/Repositories/TransactionGroup/TransactionGroupRepository.php
@@ -398,9 +398,9 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
$array['categories'] = $journal->categories->toArray();
$array['budgets'] = $journal->budgets->toArray();
$array['notes'] = $journal->notes->toArray();
- $array['locations'] = []; // todo
+ $array['locations'] = [];
$array['attachments'] = $journal->attachments->toArray();
- $array['links'] = []; // todo
+ $array['links'] = [];
$array['piggy_bank_events'] = $journal->piggyBankEvents->toArray();
/** @var Transaction $transaction */
diff --git a/app/Support/Http/Controllers/RenderPartialViews.php b/app/Support/Http/Controllers/RenderPartialViews.php
index 2258a175e5..8aa97bdb95 100644
--- a/app/Support/Http/Controllers/RenderPartialViews.php
+++ b/app/Support/Http/Controllers/RenderPartialViews.php
@@ -255,7 +255,7 @@ trait RenderPartialViews
{
$index = 0;
$actions = [];
- // todo must be repos
+ // must be repos
$currentActions = $rule->ruleActions()->orderBy('order', 'ASC')->get();
/** @var RuleAction $entry */
foreach ($currentActions as $entry) {
@@ -304,7 +304,7 @@ trait RenderPartialViews
asort($triggers);
$index = 0;
$renderedEntries = [];
- // todo must be repos
+ // must be repos
$currentTriggers = $rule->ruleTriggers()->orderBy('order', 'ASC')->get();
/** @var RuleTrigger $entry */
foreach ($currentTriggers as $entry) {
diff --git a/config/auth.php b/config/auth.php
index 09c2b6e5b0..e9fa206dd4 100644
--- a/config/auth.php
+++ b/config/auth.php
@@ -21,6 +21,8 @@
declare(strict_types=1);
+use FireflyIII\Ldap\AttributeHandler;
+
return [
/*
|--------------------------------------------------------------------------
@@ -111,9 +113,7 @@ return [
'database' => [
'model' => FireflyIII\User::class,
'sync_passwords' => false,
- 'sync_attributes' => [
- 'email' => 'mail',
- ],
+ 'sync_attributes' => AttributeHandler::class,
],
],
],