features/fiche_refonte #278

Merged
judaur2005 merged 2 commits from features/fiche_refonte into develop 2026-07-28 16:34:37 +00:00
4 changed files with 33 additions and 32 deletions
Showing only changes of commit d19dab4e68 - Show all commits

View File

@@ -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") @PostMapping("/change-password")
@PreAuthorize("hasAuthority('UPDATE_USER')") @PreAuthorize("hasAuthority('CHANGE_MY_PASSWORD')")
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')")
public ResponseEntity<?> changeMyPassword(@CurrentUser UserPrincipal currentUser, @RequestBody Login login) { public ResponseEntity<?> changeMyPassword(@CurrentUser UserPrincipal currentUser, @RequestBody Login login) {
try { try {
User user = currentUser.getUser() ; User user = currentUser.getUser() ;

View File

@@ -3,6 +3,7 @@ package io.gmss.fiscad.enums;
public enum UserRole { public enum UserRole {
VALIDE_ENQUETE, VALIDE_ENQUETE,
APPROVAL_AVIS, APPROVAL_AVIS,
CHANGE_MY_PASSWORD,
CREATE_ARRONDISSEMENT, CREATE_ARRONDISSEMENT,
READ_ARRONDISSEMENT, READ_ARRONDISSEMENT,
UPDATE_ARRONDISSEMENT, UPDATE_ARRONDISSEMENT,

View File

@@ -24,7 +24,7 @@ public class UserPaylaodWeb {
private Long structureId; private Long structureId;
private String structureCode; private String structureCode;
private String structureNom; private String structureNom;
private Boolean actif; private Boolean active;
private Boolean resetPassword; private Boolean resetPassword;
public UserPaylaodWeb(Long id, public UserPaylaodWeb(Long id,
@@ -36,7 +36,7 @@ public class UserPaylaodWeb {
Long structureId, Long structureId,
String structureCode, String structureCode,
String structureNom, String structureNom,
Boolean actif, Boolean active,
Boolean resetPassword) { Boolean resetPassword) {
this.id = id; this.id = id;
this.nom = nom; this.nom = nom;
@@ -47,7 +47,7 @@ public class UserPaylaodWeb {
this.structureId = structureId; this.structureId = structureId;
this.structureCode = structureCode; this.structureCode = structureCode;
this.structureNom = structureNom; this.structureNom = structureNom;
this.actif = actif; this.active = active;
this.resetPassword = resetPassword; this.resetPassword = resetPassword;
} }
} }

View File

@@ -1,6 +1,6 @@
spring.profiles.active=${SPRING_PROFILES_ACTIVE} #spring.profiles.active=${SPRING_PROFILES_ACTIVE}
#spring.profiles.active=abomey #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.id.new_generator_mappings=false
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
spring.jpa.open-in-view=false spring.jpa.open-in-view=false