From 209253887a76e9fb2c39af76e1a7d657214ceece Mon Sep 17 00:00:00 2001 From: Henning Zimmermann <hzimmermann@zwh.de> Date: Mon, 7 Oct 2024 08:54:08 +0200 Subject: [PATCH] =?UTF-8?q?-=20Beim=20Registrieren=20von=20Benutzenden=20m?= =?UTF-8?q?uss=20nun=20angegeben=20werden,=20ob=20eine=20E-Mail=20vom=20ZL?= =?UTF-8?q?S=20verschickt=20wird=20-=20Beim=20=C3=84ndern=20von=20Benutzen?= =?UTF-8?q?den=20wird=20das=20grunds=C3=A4tzlich=20nicht=20gemacht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Helper/RegisterUserInZls.php | 8 +++++--- src/Jobs/User/ChangeUserDataJob.php | 5 ++++- src/Jobs/UserRegistrationJob.php | 5 +++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Helper/RegisterUserInZls.php b/src/Helper/RegisterUserInZls.php index 4d3cfb7..f714031 100644 --- a/src/Helper/RegisterUserInZls.php +++ b/src/Helper/RegisterUserInZls.php @@ -18,8 +18,10 @@ class RegisterUserInZls /** @var Collection<int, UserImportData> */ private Collection $users; - public function __construct(private readonly string $userApiImporterJobClassName) - { + public function __construct( + private readonly string $userApiImporterJobClassName, + private readonly bool $sendEmail + ) { $this->users = new Collection; } @@ -40,7 +42,7 @@ class RegisterUserInZls $apiToken = $this->getZlsHttpTransferWithApiToken(); $chain = [ - new UserRegistrationJob($apiToken, $this->users), + new UserRegistrationJob($apiToken, $this->users, $this->sendEmail), new $this->userApiImporterJobClassName($apiToken) ]; diff --git a/src/Jobs/User/ChangeUserDataJob.php b/src/Jobs/User/ChangeUserDataJob.php index 18695e3..a91b98d 100644 --- a/src/Jobs/User/ChangeUserDataJob.php +++ b/src/Jobs/User/ChangeUserDataJob.php @@ -29,7 +29,10 @@ class ChangeUserDataJob extends AbstractUserApiWithTokenJob $this->httpTransfer->apiUrl = Env::getOrFail('ZLS_URL') . '/api/user/' . $this->userId . '/change'; // Benutzer ändern - $jsonResult = $this->httpTransfer->post(['users' => [$this->userData->toArray()]]); + $jsonResult = $this->httpTransfer->post([ + 'sendEmail' => false, + 'users' => [$this->userData->toArray() + ]]); // Rückgabe prüfen und mit JSON-Schema validieren $this->getDataFromBody($jsonResult); diff --git a/src/Jobs/UserRegistrationJob.php b/src/Jobs/UserRegistrationJob.php index eba975d..0303f4e 100644 --- a/src/Jobs/UserRegistrationJob.php +++ b/src/Jobs/UserRegistrationJob.php @@ -15,7 +15,8 @@ class UserRegistrationJob extends AbstractZlsApiWithTokenJob */ public function __construct( HttpTransfer $httpTransfer, - private readonly Collection $userDataCollection + private readonly Collection $userDataCollection, + private readonly bool $sendEmail ) { $httpTransfer->apiUrl = Env::getOrFail('ZLS_URL') . '/api/users/import'; @@ -29,7 +30,7 @@ class UserRegistrationJob extends AbstractZlsApiWithTokenJob { $this->jsonSchemaFile = 'simple_api.json'; - $data = []; + $data = ['sendEmail' => $this->sendEmail]; /** @var UserImportData $userData */ foreach ($this->userDataCollection as $userData) { -- GitLab