소스 검색

post MR fixes

Olivier Massot 1 년 전
부모
커밋
e8a6a65c13
2개의 변경된 파일19개의 추가작업 그리고 19개의 파일을 삭제
  1. 0 3
      src/Doctrine/Booking/AttendanceBookingReasonExtension.php
  2. 19 16
      src/Entity/Booking/AttendanceBookingReason.php

+ 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")]