|
|
@@ -11,6 +11,7 @@ use App\ApiResources\Export\ExportRequest;
|
|
|
use App\Entity\Access\Access;
|
|
|
use App\Entity\Core\File;
|
|
|
use App\Message\Command\Export;
|
|
|
+use App\Service\Network\Utils as NetworkUtils;
|
|
|
use App\Service\ServiceIterator\ExporterIterator;
|
|
|
use Symfony\Bundle\SecurityBundle\Security;
|
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
@@ -21,7 +22,8 @@ class ExportRequestProcessor implements ProcessorInterface
|
|
|
public function __construct(
|
|
|
private Security $security,
|
|
|
private MessageBusInterface $messageBus,
|
|
|
- private ExporterIterator $handler
|
|
|
+ private ExporterIterator $handler,
|
|
|
+ private NetworkUtils $networkUtils
|
|
|
) {
|
|
|
}
|
|
|
|
|
|
@@ -42,6 +44,10 @@ class ExportRequestProcessor implements ProcessorInterface
|
|
|
$access = $this->security->getUser();
|
|
|
$exportRequest->setRequesterId($access->getId());
|
|
|
|
|
|
+ if (!$this->networkUtils->isCMFAndActiveNow($access->getOrganization())) {
|
|
|
+ throw new \RuntimeException('This organization is not a member of the CMF', Response::HTTP_FORBIDDEN);
|
|
|
+ }
|
|
|
+
|
|
|
// Prepare the file record and attach its id to the export request
|
|
|
$exporter = $this->handler->getExporterFor($exportRequest);
|
|
|
$file = $exporter->prepareFile($exportRequest, true);
|