From d19dab4e68c4dc0fbdffa05490a7dc5fce756f25 Mon Sep 17 00:00:00 2001 From: Aurince AKAKPO Date: Tue, 28 Jul 2026 17:33:42 +0100 Subject: [PATCH 1/2] reajustement secteur decoupage perimetre --- .../controllers/user/UserController.java | 54 +++++++++---------- .../java/io/gmss/fiscad/enums/UserRole.java | 1 + .../request/crudweb/UserPaylaodWeb.java | 6 +-- src/main/resources/application.properties | 4 +- 4 files changed, 33 insertions(+), 32 deletions(-) diff --git a/src/main/java/io/gmss/fiscad/controllers/user/UserController.java b/src/main/java/io/gmss/fiscad/controllers/user/UserController.java index 0178f3e..ef571d3 100755 --- a/src/main/java/io/gmss/fiscad/controllers/user/UserController.java +++ b/src/main/java/io/gmss/fiscad/controllers/user/UserController.java @@ -70,34 +70,34 @@ public class UserController { } } +// @PostMapping("/change-password") +// @PreAuthorize("hasAuthority('UPDATE_USER')") +// public ResponseEntity changeUserPassword(@RequestBody Login login) { +// try { +// userService.updatePassword(login.getUsername(), login.getPassword()); +// return new ResponseEntity<>( +// new ApiResponse<>(true, "Votre mot de passe à été modifiée avec succès."), +// HttpStatus.OK +// ); +// } catch (HttpClientErrorException.MethodNotAllowed e) { +// logger.error(e.getLocalizedMessage()); +// return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK); +// } catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException | +// FileStorageException e) { +// logger.error(e.getLocalizedMessage()); +// return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK); +// } catch (NullPointerException e) { +// logger.error(e.getLocalizedMessage()); +// return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK); +// } catch (Exception e) { +// logger.error(e.getLocalizedMessage()); +// return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK); +// } +// } + + @PostMapping("/change-password") - @PreAuthorize("hasAuthority('UPDATE_USER')") - public ResponseEntity changeUserPassword(@RequestBody Login login) { - try { - userService.updatePassword(login.getUsername(), login.getPassword()); - return new ResponseEntity<>( - new ApiResponse<>(true, "Votre mot de passe à été modifiée avec succès."), - HttpStatus.OK - ); - } catch (HttpClientErrorException.MethodNotAllowed e) { - logger.error(e.getLocalizedMessage()); - return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK); - } catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException | - FileStorageException e) { - logger.error(e.getLocalizedMessage()); - return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK); - } catch (NullPointerException e) { - logger.error(e.getLocalizedMessage()); - return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK); - } catch (Exception e) { - logger.error(e.getLocalizedMessage()); - return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK); - } - } - - - @PostMapping("/change-my-password") - @PreAuthorize("hasAuthority('UPDATE_USER')") + @PreAuthorize("hasAuthority('CHANGE_MY_PASSWORD')") public ResponseEntity changeMyPassword(@CurrentUser UserPrincipal currentUser, @RequestBody Login login) { try { User user = currentUser.getUser() ; diff --git a/src/main/java/io/gmss/fiscad/enums/UserRole.java b/src/main/java/io/gmss/fiscad/enums/UserRole.java index f58168f..d4b08de 100644 --- a/src/main/java/io/gmss/fiscad/enums/UserRole.java +++ b/src/main/java/io/gmss/fiscad/enums/UserRole.java @@ -3,6 +3,7 @@ package io.gmss.fiscad.enums; public enum UserRole { VALIDE_ENQUETE, APPROVAL_AVIS, + CHANGE_MY_PASSWORD, CREATE_ARRONDISSEMENT, READ_ARRONDISSEMENT, UPDATE_ARRONDISSEMENT, diff --git a/src/main/java/io/gmss/fiscad/paylaods/request/crudweb/UserPaylaodWeb.java b/src/main/java/io/gmss/fiscad/paylaods/request/crudweb/UserPaylaodWeb.java index cab92e2..96a0147 100644 --- a/src/main/java/io/gmss/fiscad/paylaods/request/crudweb/UserPaylaodWeb.java +++ b/src/main/java/io/gmss/fiscad/paylaods/request/crudweb/UserPaylaodWeb.java @@ -24,7 +24,7 @@ public class UserPaylaodWeb { private Long structureId; private String structureCode; private String structureNom; - private Boolean actif; + private Boolean active; private Boolean resetPassword; public UserPaylaodWeb(Long id, @@ -36,7 +36,7 @@ public class UserPaylaodWeb { Long structureId, String structureCode, String structureNom, - Boolean actif, + Boolean active, Boolean resetPassword) { this.id = id; this.nom = nom; @@ -47,7 +47,7 @@ public class UserPaylaodWeb { this.structureId = structureId; this.structureCode = structureCode; this.structureNom = structureNom; - this.actif = actif; + this.active = active; this.resetPassword = resetPassword; } } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 1a74ba6..b02753a 100755 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,6 +1,6 @@ -spring.profiles.active=${SPRING_PROFILES_ACTIVE} +#spring.profiles.active=${SPRING_PROFILES_ACTIVE} #spring.profiles.active=abomey -#spring.profiles.active=test +spring.profiles.active=test spring.jpa.properties.hibernate.id.new_generator_mappings=false spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true spring.jpa.open-in-view=false From c93994652d94088d408fa76f582063e2aa958340 Mon Sep 17 00:00:00 2001 From: Aurince AKAKPO Date: Tue, 28 Jul 2026 17:34:12 +0100 Subject: [PATCH 2/2] reajustement secteur decoupage perimetre --- src/main/resources/application.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index b02753a..1a74ba6 100755 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,6 +1,6 @@ -#spring.profiles.active=${SPRING_PROFILES_ACTIVE} +spring.profiles.active=${SPRING_PROFILES_ACTIVE} #spring.profiles.active=abomey -spring.profiles.active=test +#spring.profiles.active=test spring.jpa.properties.hibernate.id.new_generator_mappings=false spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true spring.jpa.open-in-view=false