mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	Clean up code.
This commit is contained in:
		
							
								
								
									
										41
									
								
								app/Ldap/AttributeHandler.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								app/Ldap/AttributeHandler.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,41 @@ | ||||
| <?php | ||||
| /* | ||||
|  * AttributeHandler.php | ||||
|  * Copyright (c) 2021 james@firefly-iii.org | ||||
|  * | ||||
|  * 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(); | ||||
|     } | ||||
| } | ||||
| @@ -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 */ | ||||
|   | ||||
| @@ -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) { | ||||
|   | ||||
| @@ -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, | ||||
|             ], | ||||
|         ], | ||||
|     ], | ||||
|   | ||||
		Reference in New Issue
	
	Block a user