From 3d5d8112ea021e4a2a6bb5d6b75f1b4abb028efe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20D=C4=9Bdi=C4=8D?= Date: Wed, 7 Feb 2024 17:39:44 +0100 Subject: [PATCH] Merged education accountant and regular accountant functions --- .../PaymentModule/presenters/BankAccountsPresenter.php | 2 +- .../ReadModel/QueryHandlers/EditableUnitsQueryHandler.php | 2 +- app/model/User/SkautisRole.php | 7 +------ app/model/User/UserService.php | 2 +- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/app/AccountancyModule/PaymentModule/presenters/BankAccountsPresenter.php b/app/AccountancyModule/PaymentModule/presenters/BankAccountsPresenter.php index 9466b4061..d038536b7 100644 --- a/app/AccountancyModule/PaymentModule/presenters/BankAccountsPresenter.php +++ b/app/AccountancyModule/PaymentModule/presenters/BankAccountsPresenter.php @@ -236,7 +236,7 @@ private function assertCanViewBankAccount(int $id): void if ( $role->getUnitId() === $account->getUnitId() && $role->isBasicUnit() - && ($role->isAccountant() || $role->isOfficer() || $role->isEventManager() || $role->isEducationLeader() || $role->isEducationAccountant()) + && ($role->isAccountant() || $role->isOfficer() || $role->isEventManager() || $role->isEducationLeader()) ) { return; } diff --git a/app/model/User/ReadModel/QueryHandlers/EditableUnitsQueryHandler.php b/app/model/User/ReadModel/QueryHandlers/EditableUnitsQueryHandler.php index d1dc77a09..a5ecaa4b9 100644 --- a/app/model/User/ReadModel/QueryHandlers/EditableUnitsQueryHandler.php +++ b/app/model/User/ReadModel/QueryHandlers/EditableUnitsQueryHandler.php @@ -19,7 +19,7 @@ public function __invoke(EditableUnitsQuery $query): array { $role = $query->getRole(); - if (! ($role->isLeader() || $role->isAccountant() || $role->isEventManager() || $role->isEducationLeader() || $role->isEducationAccountant())) { + if (! ($role->isLeader() || $role->isAccountant() || $role->isEventManager() || $role->isEducationLeader())) { return []; } diff --git a/app/model/User/SkautisRole.php b/app/model/User/SkautisRole.php index 6bcf7b4d5..62802ee21 100644 --- a/app/model/User/SkautisRole.php +++ b/app/model/User/SkautisRole.php @@ -46,7 +46,7 @@ public function isLeader(): bool public function isAccountant(): bool { - return Strings::startsWith($this->key, self::ACCOUNTANT_PREFIX); + return Strings::startsWith($this->key, self::ACCOUNTANT_PREFIX) || $this->key === 'EventEducationEconomist'; } public function isEducationLeader(): bool @@ -54,11 +54,6 @@ public function isEducationLeader(): bool return $this->key === 'EventEducationLeader'; } - public function isEducationAccountant(): bool - { - return $this->key === 'EventEducationEconomist'; - } - public function isOfficer(): bool { return Strings::startsWith($this->key, self::OFFICER_PREFIX); diff --git a/app/model/User/UserService.php b/app/model/User/UserService.php index 6280f1b5e..8f5dd4b1d 100644 --- a/app/model/User/UserService.php +++ b/app/model/User/UserService.php @@ -144,7 +144,7 @@ public function getAccessArrays(UnitService $us): array ]; } - if ($role->isLeader() || $role->isAccountant() || $role->isEventManager() || $role->isEducationLeader() || $role->isEducationAccountant()) { + if ($role->isLeader() || $role->isAccountant() || $role->isEventManager() || $role->isEducationLeader()) { return [ self::ACCESS_READ => $unitIds, self::ACCESS_EDIT => $unitIds,