diff --git a/src/main/java/com/covas/Resources/UsersRessources.java b/src/main/java/com/covas/Resources/UsersRessources.java index 00a7461..633b592 100644 --- a/src/main/java/com/covas/Resources/UsersRessources.java +++ b/src/main/java/com/covas/Resources/UsersRessources.java @@ -180,11 +180,10 @@ public class UsersRessources { // PUT @PUT - @Path("{pseudo}") @RolesAllowed("Admin") @Consumes(MediaType.APPLICATION_JSON) @Transactional - public Response addUser(@Context SecurityContext ctx, @CookieParam("user") String userCookie, @PathParam("pseudo") String pseudo, + public Response addUser(@Context SecurityContext ctx, @CookieParam("user") String userCookie, UsersEntity users) { UUID kid = UUID.fromString(jwt.getClaim(Claims.kid)); UsersEntity user = UsersEntity.findById(kid); @@ -192,13 +191,13 @@ public class UsersRessources { if (status.equals(Response.Status.OK)) { - UsersEntity usersOrig = UsersEntity.findByPseudo(pseudo); + UsersEntity usersOrig = UsersEntity.findByPseudo(users.pseudo); if (usersOrig != null) { status = Response.Status.UNAUTHORIZED; } else { UsersEntity usersNew = new UsersEntity(); usersNew.name = users.name; - usersNew.pseudo = pseudo; + usersNew.pseudo = users.pseudo; usersNew.firstName = users.firstName; usersNew.email = users.email; usersNew.birth = LocalDate.of(users.birth.getYear(), users.birth.getMonth(), @@ -208,7 +207,7 @@ public class UsersRessources { usersNew.password = Hash .encryptSHA512(Base64.toBase64String(users.password.getBytes(StandardCharsets.UTF_8))); usersNew.roles = users.roles; - usersNew.status = 2; + usersNew.status = 1; usersNew.persist(); if (usersNew.isPersistent()) { status = Response.Status.CREATED;