Get all user

This commit is contained in:
Marc Beyer 2022-01-28 05:54:26 +01:00
parent 2f70515407
commit 4e07b01b6a
2 changed files with 15 additions and 2 deletions

View File

@ -148,7 +148,7 @@ public class DataController {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
objectMapper.findAndRegisterModules(); objectMapper.findAndRegisterModules();
try { try {
return objectMapper.readValue(userJSON, new TypeReference<List<User>>() {}); return (List<User>)objectMapper.readValue(userJSON, new TypeReference<List<User>>() {});
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -158,7 +158,11 @@ public class DataController {
public void createUser(User user) throws HttpRequestException { public void createUser(User user) throws HttpRequestException {
sendBasicHttpRequest( sendBasicHttpRequest(
ADD_USER_ENDPOINT, ADD_USER_ENDPOINT,
"", "name=" + user.getName() +
"&forename=" + user.getForename() +
"&login=" + user.getLogin() +
"&password=" + user.getPassword() +
"&isAdmin=" + user.isAdmin(),
true true
); );
} }

View File

@ -6,6 +6,7 @@ public class User {
private String login; private String login;
private String forename; private String forename;
private String name; private String name;
private String password;
private boolean isAdmin; private boolean isAdmin;
public User(){} public User(){}
@ -49,4 +50,12 @@ public class User {
public void setAdmin(boolean admin) { public void setAdmin(boolean admin) {
isAdmin = admin; isAdmin = admin;
} }
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
} }