Selaa lähdekoodia

remove the admin username change after subdomain activation

Olivier Massot 3 vuotta sitten
vanhempi
commit
ceb34e33ce
1 muutettua tiedostoa jossa 0 lisäystä ja 36 poistoa
  1. 0 36
      src/Service/OnChange/Organization/OnSubdomainChange.php

+ 0 - 36
src/Service/OnChange/Organization/OnSubdomainChange.php

@@ -53,14 +53,6 @@ class OnSubdomainChange extends OnChangeDefault
             $this->bindFileService->registerSubdomain($subdomain->getSubdomain());
         }
 
-        // Update the admin username
-        //if ($this->isPutRequest() && $this->previousData()) {
-        //    if ($subdomain->isActive() && !$this->previousData()->isActive()) {
-        //        $this->onSubdomainChange->updateAdminUsername($subdomain->getOrganization());
-        //        $shallPersist = true;
-        //    }
-        //}
-
         if ($shallPersist) {
             $this->entityManager->flush();
         }
@@ -83,34 +75,6 @@ class OnSubdomainChange extends OnChangeDefault
         }
     }
 
-    /**
-     * Update the admin username to match the pattern 'admin{subdomain}'
-     *
-     * @param Organization $organization
-     */
-    public function updateAdminUsername(Organization $organization): void
-    {
-        $subdomain = \App\Service\Organization\Utils::getOrganizationActiveSubdomain($organization);
-        if (!$subdomain) {
-            throw new \RuntimeException('Organization has no active subdomain : ' . $organization->getId());
-        }
-
-        $admin = $this->accessUtils->findAdminFor($organization);
-        if (!$admin) {
-            throw new \RuntimeException('No admin found for organization ' . $organization->getId());
-        }
-
-        $newUsername = 'admin' . $subdomain;
-        /** @noinspection NullPointerExceptionInspection */
-        $admin->getPerson()->setUsername($newUsername);
-
-        if($this->security->getUser()->getId() === $admin->getId()){
-            // todo : déplacer ça dans un service dédié
-            $jwt = $this->jwtManager->create($admin->getPerson());
-            setcookie('BEARER', $jwt, 0, '/', '.opentalent.fr', false, true);
-        }
-    }
-
     /**
      * @throws \Exception
      */