feat(commercial) : enforce RG-1.04 completeness for commerciale role

- RG-1.04 durcie : pour une Commerciale, la completude de l'onglet Information est
  exigee sur POST et sur tout PATCH, independamment des champs envoyes (suppression
  de la condition d'intersection dans validateInformationCompleteness).
- Onglet Comptabilite editable par Compta : security du Patch /clients/{id} elargie
  a `manage` OU `accounting.manage` ; nouveau guardManage (ClientProcessor, mode
  strict RG-1.28) qui refuse a un porteur non-`manage` de modifier les onglets
  principal / Information -> 403. Compta reste donc cantonne a la Comptabilite.
- Spec § 7 RG-1.04 amendee (+ consequence POST 422) + docblock du validator.
- Tests unitaires ClientProcessor : guardManage (Compta accounting-only -> 200,
  champ metier -> 403) + RG-1.04 durcie hors onglet Information.
This commit is contained in:
Matthieu
2026-06-01 22:26:49 +02:00
parent 275c6ff5b5
commit 09e1d7884a
5 changed files with 226 additions and 31 deletions
+10 -2
View File
@@ -83,11 +83,19 @@ use Symfony\Component\Validator\Constraints as Assert;
processor: ClientProcessor::class,
),
new Patch(
security: "is_granted('commercial.clients.manage')",
// Security elargie (ERP-74) : `manage` OU `accounting.manage`. Le
// role Compta n'a pas `manage` mais doit pouvoir editer l'onglet
// Comptabilite d'un client existant (§ 2.7). Le ClientProcessor
// re-gate ensuite onglet par onglet :
// - champs accounting -> accounting.manage (guardAccounting, RG-1.28) ;
// - champs main/information -> manage (guardManage : empeche Compta
// d'editer les autres onglets) ;
// - isArchived -> archive (guardArchive, RG-1.22).
security: "is_granted('commercial.clients.manage') or is_granted('commercial.clients.accounting.manage')",
// Le ClientProcessor inspecte les champs reellement envoyes pour
// autoriser/refuser onglet par onglet (RG-1.22 / RG-1.28) : les
// champs accounting exigent accounting.manage, isArchived exige
// archive.
// archive, le reste (main/information) exige manage.
normalizationContext: ['groups' => ['client:read', 'default:read']],
denormalizationContext: ['groups' => [
'client:write:main',