From 8c8b9ce7d6eaac786532cd1d2821f554ac7b07ec Mon Sep 17 00:00:00 2001 From: dev4 Date: Fri, 19 Sep 2025 07:23:42 +0000 Subject: [PATCH] ci: docker_tag=ext chore(back): log analyse IdNot (rattachement) --- CHANGELOG.md | 4 ++++ docs/analyse.md | 2 +- src/controllers/idnot.controller.ts | 10 ++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 252c0fc..f4b7b15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,3 +21,7 @@ - Laisse désormais passer toute erreur avec `statusCode` 4xx même si l’instance n’est pas exactement celle des classes locales. - Fallback sur `name` (BusinessRuleError, ForbiddenError, UnauthorizedError, ValidationError) pour tolérer les divergences d’instances. - Objectif: éviter les 502 lorsqu’un cas fonctionnel (ex: utilisateur non rattaché) survient, et renvoyer le bon 4xx. + +### v1.0.3+log + +- Ajout d’un log d’analyse non sensible dans `IdNotController.authenticate` pour tracer: `profile_idn`, `entity_idn`, `entite.typeEntite.name`, `entite.codeCrpcen`, `statutDuRattachement`, `typeLien.name`. diff --git a/docs/analyse.md b/docs/analyse.md index cc24960..57ce57f 100644 --- a/docs/analyse.md +++ b/docs/analyse.md @@ -36,7 +36,7 @@ Analyse synthétique de `lecoffre-back-mini` (Express + TypeScript). - `403`: utilisateur non rattaché à une étude (ForbiddenError) - `5xx`: erreurs internes ou partenaires (ExternalServiceError) -Note: dans `IdNotController.authenticate`, toute erreur possédant un `statusCode` 4xx (ou un `name` applicatif connu) est relancée telle quelle afin d’éviter un fallback en 502. +Note: dans `IdNotController.authenticate`, toute erreur possédant un `statusCode` 4xx (ou un `name` applicatif connu) est relancée telle quelle afin d’éviter un fallback en 502. ### Dépendances clés - **HTTP**: `express`, `cors` diff --git a/src/controllers/idnot.controller.ts b/src/controllers/idnot.controller.ts index 86f9345..d02bbb1 100644 --- a/src/controllers/idnot.controller.ts +++ b/src/controllers/idnot.controller.ts @@ -104,6 +104,16 @@ export class IdNotController { // Get user data const userData = await IdNotService.getUserData(payload.profile_idn); + // Log d'analyse (non sensible) pour diagnostiquer les cas de rattachement + Logger.info('IdNot userData summary', { + profile_idn: payload.profile_idn, + entity_idn: payload.entity_idn, + entiteTypeName: userData?.entite?.typeEntite?.name, + entiteCodeCrpcen: userData?.entite?.codeCrpcen, + statutDuRattachement: userData?.statutDuRattachement, + typeLien: userData?.typeLien?.name + }); + if (!userData || !userData.statutDuRattachement || userData.entite.typeEntite.name !== 'office') { throw new ForbiddenError('User not attached to an office'); }