diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php index 1a716f17e..3b2bd5a42 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php +++ b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php @@ -46,7 +46,6 @@ final class DocGeneratorTemplateController extends AbstractController public function __construct( private readonly ContextManager $contextManager, private readonly DocGeneratorTemplateRepository $docGeneratorTemplateRepository, - private readonly GeneratorInterface $generator, private readonly MessageBusInterface $messageBus, private readonly PaginatorFactory $paginatorFactory, private readonly EntityManagerInterface $entityManager, @@ -276,12 +275,11 @@ final class DocGeneratorTemplateController extends AbstractController $sendResultTo = ($form ?? null)?->get('send_result_to')?->getData() ?? null; $dumpOnly = ($form ?? null)?->get('dump_only')?->getData() ?? false; } else { - $creator = $this->security->getUser(); - - if (!$creator instanceof User) { + if (!$this->isGranted('ROLE_USER')) { throw new AccessDeniedHttpException('only authenticated user can request a generation'); } + $creator = $this->security->getUser(); $sendResultTo = null; $dumpOnly = false; } diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php index c20971f27..aba61fb9f 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php @@ -11,10 +11,10 @@ declare(strict_types=1); namespace Chill\DocGeneratorBundle\Service\Messenger; -use ChampsLibres\AsyncUploaderBundle\TempUrl\TempUrlGeneratorInterface; use Chill\DocGeneratorBundle\Repository\DocGeneratorTemplateRepository; use Chill\DocGeneratorBundle\Service\Generator\Generator; use Chill\DocGeneratorBundle\Service\Generator\GeneratorException; +use Chill\DocStoreBundle\AsyncUpload\TempUrlGeneratorInterface; use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Exception\StoredObjectManagerException; use Chill\DocStoreBundle\Repository\StoredObjectRepository; @@ -125,7 +125,7 @@ class RequestGenerationHandler implements MessageHandlerInterface { $url = $this->tempUrlGenerator->generate('GET', $destinationStoredObject->getFilename(), 3600); $parts = []; - parse_str(parse_url((string) $url->url)['query'], $parts); + parse_str(parse_url($url->url)['query'], $parts); $validity = \DateTimeImmutable::createFromFormat('U', $parts['temp_url_expires']); $email = (new TemplatedEmail())