From 4e07b01b6ad7e8ce63f0586951bb0dcec0b76c74 Mon Sep 17 00:00:00 2001 From: Marc Beyer Date: Fri, 28 Jan 2022 05:54:26 +0100 Subject: [PATCH] Get all user --- client/data/src/main/java/res/DataController.java | 8 ++++++-- client/data/src/main/java/res/User.java | 9 +++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/client/data/src/main/java/res/DataController.java b/client/data/src/main/java/res/DataController.java index 181227e..2a4fb2f 100644 --- a/client/data/src/main/java/res/DataController.java +++ b/client/data/src/main/java/res/DataController.java @@ -148,7 +148,7 @@ public class DataController { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.findAndRegisterModules(); try { - return objectMapper.readValue(userJSON, new TypeReference>() {}); + return (List)objectMapper.readValue(userJSON, new TypeReference>() {}); } catch (JsonProcessingException e) { e.printStackTrace(); } @@ -158,7 +158,11 @@ public class DataController { public void createUser(User user) throws HttpRequestException { sendBasicHttpRequest( ADD_USER_ENDPOINT, - "", + "name=" + user.getName() + + "&forename=" + user.getForename() + + "&login=" + user.getLogin() + + "&password=" + user.getPassword() + + "&isAdmin=" + user.isAdmin(), true ); } diff --git a/client/data/src/main/java/res/User.java b/client/data/src/main/java/res/User.java index c917e7e..d58461b 100644 --- a/client/data/src/main/java/res/User.java +++ b/client/data/src/main/java/res/User.java @@ -6,6 +6,7 @@ public class User { private String login; private String forename; private String name; + private String password; private boolean isAdmin; public User(){} @@ -49,4 +50,12 @@ public class User { public void setAdmin(boolean admin) { isAdmin = admin; } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } }