Merge pull request 'features/fiche_refonte' (#278) from features/fiche_refonte into develop
Reviewed-on: #278
This commit was merged in pull request #278.
This commit is contained in:
@@ -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() ;
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user