remove path for put method
This commit is contained in:
parent
a147315851
commit
f64640db45
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user