[DEV] better get user interface (no propagate password

This commit is contained in:
Edouard DUPIN 2023-01-06 00:26:22 +01:00
parent c845ab6847
commit 0c5f524906
3 changed files with 30 additions and 6 deletions

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.kar</groupId>
<artifactId>karso</artifactId>
<version>0.2.0</version>
<version>0.3.0</version>
<properties>
<!--
<jaxb.version>2.3.1</jaxb.version>
@ -27,7 +27,7 @@
<dependency>
<groupId>kangaroo-and-rabbit</groupId>
<artifactId>archidata</artifactId>
<version>0.2.2</version>
<version>0.2.3</version>
</dependency>
<!-- testing -->
<dependency>

View File

@ -34,16 +34,16 @@ public class UserResource {
}
@GET
@RolesAllowed("ADMIN")
public List<UserAuth> getUsers() throws Exception {
return SqlWrapper.gets(UserAuth.class, false);
public List<UserAuthGet> getUsers() throws Exception {
return SqlWrapper.gets(UserAuthGet.class, false);
}
@GET
@Path("{id}")
@RolesAllowed("ADMIN")
public UserAuth getUser(@Context SecurityContext sc, @PathParam("id") long userId) throws Exception {
public UserAuthGet getUser(@Context SecurityContext sc, @PathParam("id") long userId) throws Exception {
GenericContext gc = (GenericContext) sc.getUserPrincipal();
return SqlWrapper.get(UserAuth.class, userId);
return SqlWrapper.get(UserAuthGet.class, userId);
}
@POST

View File

@ -0,0 +1,24 @@
package org.kar.karso.model;
import java.sql.Timestamp;
import org.kar.archidata.annotation.SQLDefault;
import org.kar.archidata.annotation.SQLIfNotExists;
import org.kar.archidata.annotation.SQLLimitSize;
import org.kar.archidata.annotation.SQLNotNull;
import org.kar.archidata.annotation.SQLTableName;
import org.kar.archidata.model.User;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@SQLTableName ("user")
@SQLIfNotExists
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
public class UserAuthGet extends User {
@SQLLimitSize(512)
@SQLNotNull
public String email;
@SQLDefault("'0'")
@SQLNotNull
public boolean avatar = false;
}