浏览代码

post MR fixes

Olivier Massot 1 年之前
父节点
当前提交
e8a6a65c13

+ 0 - 3
src/Doctrine/Booking/AttendanceBookingReasonExtension.php

@@ -24,9 +24,6 @@ final class AttendanceBookingReasonExtension extends AbstractExtension
         return $resourceClass === AttendanceBookingReason::class;
     }
 
-    /**
-     * @todo : A la suite de la migration, il faut supprimer le where avec le discr.
-     */
     protected function addWhere(QueryBuilder $queryBuilder, string $resourceClass, ?Operation $operation): void
     {
         /** @var Access $currentUser */

+ 19 - 16
src/Entity/Booking/AttendanceBookingReason.php

@@ -20,22 +20,25 @@ use Doctrine\ORM\Mapping as ORM;
  *
  *   @see \App\Doctrine\Education\AttendanceBookingReasonExtension.php
  */
-#[ApiResource(operations: [
-    new Get(
-        security: 'is_granted(\'ROLE_ORGANIZATION_VIEW\') and object.getOrganization().getId() == user.getOrganization().getId()'
-    ),
-    new Put(
-        security: 'object.getOrganization().getId() == user.getOrganization().getId()'
-    ),
-    new Delete(
-        security: 'object.getOrganization().getId() == user.getOrganization().getId()'
-    ),
-    new GetCollection(
-        security: 'is_granted(\'ROLE_ORGANIZATION_VIEW\')'
-    ),
-    new Post()
-
-])]
+#[ApiResource(
+
+    operations: [
+        new Get(
+            security: 'is_granted(\'ROLE_ORGANIZATION_VIEW\') and object.getOrganization().getId() == user.getOrganization().getId()'
+        ),
+        new Put(
+            security: 'is_granted(\'ROLE_ORGANIZATION_VIEW\') and is_granted(\'ROLE_GENERAL_CONFIG\') and object.getOrganization().getId() == user.getOrganization().getId()'
+        ),
+        new Delete(
+            security: 'is_granted(\'ROLE_ORGANIZATION_VIEW\') and is_granted(\'ROLE_GENERAL_CONFIG\') and object.getOrganization().getId() == user.getOrganization().getId()'
+        ),
+        new GetCollection(
+            security: 'is_granted(\'ROLE_ORGANIZATION_VIEW\')'
+        ),
+        new Post(
+            security: 'is_granted(\'ROLE_ORGANIZATION_VIEW\') and is_granted(\'ROLE_GENERAL_CONFIG\')'
+        )]
+)]
 //#[Auditable]
 #[ORM\Table(name: 'AttendanceBookingReason')]
 #[OrganizationDefaultValue(fieldName: "organization")]