Sfoglia il codice sorgente

Merge branch 'feature/V8-5715-vrifier-les-droits-des-entits-et' into develop

Olivier Massot 1 anno fa
parent
commit
3c226a6ee8

+ 7 - 6
src/Entity/Billing/ResidenceArea.php

@@ -31,17 +31,18 @@ use Doctrine\ORM\Mapping as ORM;
             security: 'is_granted(\'ROLE_ORGANIZATION_VIEW\') and object.getBillingSetting().getOrganization().getId() == user.getOrganization().getId()'
         ),
         new Put(
-            security: 'object.getBillingSetting().getOrganization().getId() == user.getOrganization().getId()'
+            security: 'is_granted(\'ROLE_ORGANIZATION\') and object.getBillingSetting().getOrganization().getId() == user.getOrganization().getId()'
         ),
         new Delete(
-            security: 'object.getBillingSetting().getOrganization().getId() == user.getOrganization().getId()'
+            security: 'is_granted(\'ROLE_ORGANIZATION\') and object.getBillingSetting().getOrganization().getId() == user.getOrganization().getId()'
         ),
         new GetCollection(
-            security: 'is_granted(\'ROLE_ORGANIZATION_VIEW\')'
+            security: 'is_granted(\'ROLE_ORGANIZATION\')'
         ),
-        new Post(),
-    ],
-    security: 'is_granted(\'ROLE_ORGANIZATION\')'
+        new Post(
+            security: 'is_granted(\'ROLE_ORGANIZATION\')'
+        ),
+    ]
 )]
 // #[Auditable]
 #[BillingSettingDefaultValue(fieldName: 'billingSetting')]

+ 3 - 3
src/Entity/Booking/AttendanceBookingReason.php

@@ -27,16 +27,16 @@ use Doctrine\ORM\Mapping as ORM;
             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()'
+            security: 'is_granted(\'ROLE_ORGANIZATION\') 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()'
+            security: 'is_granted(\'ROLE_ORGANIZATION\') 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\')'
+            security: 'is_granted(\'ROLE_ORGANIZATION\')'
         )]
 )]
 // #[Auditable]

+ 2 - 3
src/Entity/Education/Cycle.php

@@ -30,13 +30,12 @@ use Doctrine\ORM\Mapping as ORM;
             security: 'is_granted(\'ROLE_ORGANIZATION_VIEW\') and object.getOrganization().getId() == user.getOrganization().getId()'
         ),
         new Put(
-            security: 'object.getOrganization().getId() == user.getOrganization().getId()'
+            security: 'is_granted(\'ROLE_ORGANIZATION\') and object.getOrganization().getId() == user.getOrganization().getId()'
         ),
         new GetCollection(
             security: 'is_granted(\'ROLE_ORGANIZATION_VIEW\')'
         ),
-    ],
-    security: 'is_granted(\'ROLE_ORGANIZATION\')'
+    ]
 )]
 // #[Auditable]
 #[ORM\Entity(repositoryClass: CycleRepository::class)]

+ 8 - 7
src/Entity/Education/EducationTiming.php

@@ -28,20 +28,21 @@ use Doctrine\ORM\Mapping as ORM;
 #[ApiResource(
     operations: [
         new Get(
-            security: 'is_granted(\'ROLE_ORGANIZATION_VIEW\') and object.getOrganization().getId() == user.getOrganization().getId()'
+            security: 'is_granted("ROLE_ORGANIZATION_VIEW") and object.getOrganization().getId() == user.getOrganization().getId()'
         ),
         new Put(
-            security: 'object.getOrganization().getId() == user.getOrganization().getId()'
+            security: 'is_granted("ROLE_ORGANIZATION") and object.getOrganization().getId() == user.getOrganization().getId()'
         ),
         new Delete(
-            security: 'object.getOrganization().getId() == user.getOrganization().getId()'
+            security: 'is_granted("ROLE_ORGANIZATION") and object.getOrganization().getId() == user.getOrganization().getId()'
         ),
         new GetCollection(
-            security: 'is_granted(\'ROLE_ORGANIZATION_VIEW\')'
+            security: 'is_granted("ROLE_ORGANIZATION_VIEW")'
         ),
-        new Post(),
-    ],
-    security: 'is_granted(\'ROLE_ORGANIZATION\')'
+        new Post(
+            security: 'is_granted("ROLE_ORGANIZATION")'
+        ),
+    ]
 )]
 // #[Auditable]
 #[OrganizationDefaultValue(fieldName: 'organization')]

+ 1 - 1
src/Entity/Organization/Parameters.php

@@ -28,7 +28,7 @@ use Symfony\Component\Validator\Constraints as Assert;
 #[ApiResource(
     operations: [
         new Get(
-            security: '(is_granted("ROLE_ORGANIZATION_VIEW") or is_granted("ROLE_ORGANIZATION")) and object.getOrganization().getId() == user.getOrganization().getId()'
+            security: 'is_granted("ROLE_ORGANIZATION_VIEW") and object.getOrganization().getId() == user.getOrganization().getId()'
         ),
         new Put(
             security: 'is_granted("ROLE_ORGANIZATION") and object.getOrganization().getId() == user.getOrganization().getId()'

+ 4 - 2
src/Entity/Organization/Subdomain.php

@@ -30,12 +30,14 @@ use Symfony\Component\Validator\Constraints as Assert;
 #[ApiResource(
     operations: [
         new Get(
-            security: '(is_granted("ROLE_ORGANIZATION_VIEW") or is_granted("ROLE_ORGANIZATION")) and object.getOrganization().getId() == user.getOrganization().getId()'
+            security: 'is_granted("ROLE_ORGANIZATION_VIEW") and object.getOrganization().getId() == user.getOrganization().getId()'
         ),
         new Put(
             security: 'is_granted("ROLE_ORGANIZATION") and object.getOrganization().getId() == user.getOrganization().getId()'
         ),
-        new GetCollection(),
+        new GetCollection(
+            security: 'is_granted("ROLE_ORGANIZATION_VIEW")'
+        ),
         new Post(
             security: 'is_granted("ROLE_ORGANIZATION")'
         ),