Просмотр исходного кода

update post code review (MR n°3)

Olivier Massot 3 лет назад
Родитель
Сommit
d32b7a75ab

+ 3 - 0
src/ApiResources/Export/LicenceCmf/LicenceCmfOrganizationER.php

@@ -18,6 +18,9 @@ use Symfony\Component\Validator\Constraints as Assert;
 #[ApiResource(
     collectionOperations: [
         'post' => [
+            'security' => '(is_granted("ROLE_ADMIN_CORE") or 
+                            is_granted("ROLE_ADMINISTRATIF_MANAGER_CORE") or 
+                           ) and object.getOrganizationId() == user.getOrganization().getId()',
             'method' => 'POST',
             'path' => '/licence-cmf/organization',
         ],

+ 1 - 0
src/Message/Command/Export.php

@@ -1,4 +1,5 @@
 <?php
+declare(strict_types=1);
 
 namespace App\Message\Command;
 

+ 1 - 0
src/Message/Handler/ExportHandler.php

@@ -1,4 +1,5 @@
 <?php
+declare(strict_types=1);
 
 namespace App\Message\Handler;
 

+ 11 - 1
src/Service/Export/BaseExporter.php

@@ -1,4 +1,5 @@
 <?php
+declare(strict_types=1);
 
 namespace App\Service\Export;
 
@@ -88,7 +89,7 @@ abstract class BaseExporter implements ExporterInterface
         $file->setCreatedBy($requesterId);
         // -->
         // <-- [refactoring] cette partie doit être faite après la création du fichier (storage ? service ?)
-        $file->setType('LICENCE_CMF');
+        $file->setType($this->getFileType());
         $file->setMimeType(ExportFormatEnum::getMimeType($exportRequest->getFormat()));
         $file->setName($filename);
         $file->setPath($path);
@@ -187,6 +188,15 @@ abstract class BaseExporter implements ExporterInterface
         return $this->getBasename();
     }
 
+    /**
+     * Retourne le type de fichier tel qu'il apparait au niveau du champ File.type
+     *
+     * @return string
+     */
+    protected function getFileType(): string {
+        return 'UNKNOWN';
+    }
+
     /**
      * Créé le fichier
      *

+ 1 - 0
src/Service/Export/Encoder/EncoderInterface.php

@@ -1,4 +1,5 @@
 <?php
+declare(strict_types=1);
 
 namespace App\Service\Export\Encoder;
 

+ 9 - 0
src/Service/Export/LicenceCmfExporter.php

@@ -92,6 +92,15 @@ class LicenceCmfExporter extends BaseExporter implements ExporterInterface
         return 'licence_cmf_' . $model->getLicences()[0]->getYear() . '.pdf';
     }
 
+    /**
+     * Retourne le type de fichier tel qu'il apparait au niveau du champ File.type
+     *
+     * @return string
+     */
+    protected function getFileType(): string {
+        return 'LICENCE_CMF';
+    }
+
     /**
      * Retourne la couleur de licence pour l'année donnée
      *

+ 1 - 0
src/Service/Export/Model/ExportModelInterface.php

@@ -1,4 +1,5 @@
 <?php
+declare(strict_types=1);
 
 namespace App\Service\Export\Model;
 

+ 1 - 0
src/Service/Export/Model/LicenceCmfCollection.php

@@ -1,4 +1,5 @@
 <?php
+declare(strict_types=1);
 
 namespace App\Service\Export\Model;
 

+ 1 - 0
src/Service/ServiceIterator/EncoderIterator.php

@@ -1,4 +1,5 @@
 <?php
+declare(strict_types=1);
 
 namespace App\Service\ServiceIterator;
 

+ 1 - 0
src/Service/ServiceIterator/ExporterIterator.php

@@ -1,4 +1,5 @@
 <?php
+declare(strict_types=1);
 
 namespace App\Service\ServiceIterator;