Browse Source

organization admin is now the email sender of the subdomain change email

Olivier Massot 2 years ago
parent
commit
7694141250
1 changed files with 2 additions and 8 deletions
  1. 2 8
      src/Service/Typo3/SubdomainService.php

+ 2 - 8
src/Service/Typo3/SubdomainService.php

@@ -27,13 +27,10 @@ class SubdomainService
     // Validation regex for subdomains
     // Validation regex for subdomains
     const RX_VALIDATE_SUBDOMAIN = '/^[A-Za-z0-9](?:[A-Za-z0-9\-]{0,61}[A-Za-z0-9])?$/';
     const RX_VALIDATE_SUBDOMAIN = '/^[A-Za-z0-9](?:[A-Za-z0-9\-]{0,61}[A-Za-z0-9])?$/';
 
 
-    const ADMIN_2IOS_ID = 10984;
-
     public function __construct(
     public function __construct(
         private readonly SubdomainRepository $subdomainRepository,
         private readonly SubdomainRepository $subdomainRepository,
         private readonly EntityManagerInterface $em,
         private readonly EntityManagerInterface $em,
         private readonly MessageBusInterface $messageBus,
         private readonly MessageBusInterface $messageBus,
-        private readonly Security $security,
         private readonly OrganizationUtils $organizationUtils,
         private readonly OrganizationUtils $organizationUtils,
         private readonly BindFileService $bindFileService,
         private readonly BindFileService $bindFileService,
         private readonly AccessRepository $accessRepository
         private readonly AccessRepository $accessRepository
@@ -192,13 +189,10 @@ class SubdomainService
      * @return SubdomainChangeModel
      * @return SubdomainChangeModel
      */
      */
     protected function getMailModel(Subdomain $subdomain): SubdomainChangeModel {
     protected function getMailModel(Subdomain $subdomain): SubdomainChangeModel {
-        /** @var Access $access */
-        $access = $this->security->getUser();
-
-        $senderId = $access ? $access->getId() : self::ADMIN_2IOS_ID;
+        $adminAccess = $this->accessRepository->findAdminAccess($subdomain->getOrganization());
 
 
         return (new SubdomainChangeModel())
         return (new SubdomainChangeModel())
-            ->setSenderId($senderId)
+            ->setSenderId($adminAccess->getId())
             ->setOrganizationId($subdomain->getOrganization()->getId())
             ->setOrganizationId($subdomain->getOrganization()->getId())
             ->setSubdomainId($subdomain->getId())
             ->setSubdomainId($subdomain->getId())
             ->setUrl($this->organizationUtils->getOrganizationWebsite($subdomain->getOrganization()));
             ->setUrl($this->organizationUtils->getOrganizationWebsite($subdomain->getOrganization()));