|
@@ -32,6 +32,7 @@ use App\Service\Typo3\BindFileService;
|
|
|
use App\Service\Typo3\SubdomainService;
|
|
use App\Service\Typo3\SubdomainService;
|
|
|
use App\Service\Typo3\Typo3Service;
|
|
use App\Service\Typo3\Typo3Service;
|
|
|
use App\Service\Utils\DatesUtils;
|
|
use App\Service\Utils\DatesUtils;
|
|
|
|
|
+use App\Service\Utils\SecurityUtils;
|
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
|
use Doctrine\ORM\EntityManagerInterface;
|
|
use Doctrine\ORM\EntityManagerInterface;
|
|
|
use Elastica\Param;
|
|
use Elastica\Param;
|
|
@@ -603,7 +604,7 @@ class OrganizationFactory
|
|
|
*/
|
|
*/
|
|
|
public function delete(OrganizationDeletionRequest $organizationDeletionRequest): OrganizationDeletionRequest
|
|
public function delete(OrganizationDeletionRequest $organizationDeletionRequest): OrganizationDeletionRequest
|
|
|
{
|
|
{
|
|
|
- $this->preventIfNotLocalhost();
|
|
|
|
|
|
|
+ SecurityUtils::preventIfNotLocalhost();
|
|
|
|
|
|
|
|
$organization = $this->organizationRepository->find($organizationDeletionRequest->getOrganizationId());
|
|
$organization = $this->organizationRepository->find($organizationDeletionRequest->getOrganizationId());
|
|
|
|
|
|
|
@@ -684,23 +685,6 @@ class OrganizationFactory
|
|
|
return $organizationDeletionRequest;
|
|
return $organizationDeletionRequest;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * Lève une exception si la méthode a été appelée dans le cadre d'un appel API originaire d'un hôte
|
|
|
|
|
- * différent de localhost.
|
|
|
|
|
- *
|
|
|
|
|
- * @return void
|
|
|
|
|
- */
|
|
|
|
|
- protected function preventIfNotLocalhost(): void
|
|
|
|
|
- {
|
|
|
|
|
- if (
|
|
|
|
|
- $_SERVER &&
|
|
|
|
|
- $_SERVER['APP_ENV'] !== 'docker' &&
|
|
|
|
|
- $_SERVER['SERVER_ADDR'] !== $_SERVER['REMOTE_ADDR']
|
|
|
|
|
- ) {
|
|
|
|
|
- throw new \RuntimeException("This operation is restricted to localhost");
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* Supprime tous les Access d'une organisation, ainsi que la Person
|
|
* Supprime tous les Access d'une organisation, ainsi que la Person
|
|
|
* rattachée (si celle-ci n'est pas liée à d'autres Access)
|
|
* rattachée (si celle-ci n'est pas liée à d'autres Access)
|
|
@@ -749,7 +733,7 @@ class OrganizationFactory
|
|
|
|
|
|
|
|
protected function deleteDolibarrSociety(Organization $organization): void
|
|
protected function deleteDolibarrSociety(Organization $organization): void
|
|
|
{
|
|
{
|
|
|
- // TODO: implement
|
|
|
|
|
|
|
+ $this->dolibarrApiService->deleteDolibarrSociety($organization->getId());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
protected function deleteLocalDirectories(Organization $organization): void
|
|
protected function deleteLocalDirectories(Organization $organization): void
|