add function count for admin

This commit is contained in:
Valentin CZERYBA 2022-07-26 00:09:17 +02:00
parent 8625dd44e7
commit 53eb700afb

View File

@ -77,6 +77,20 @@ public class UsersRessources {
return responseHttp;
}
@GET
@RolesAllowed("Admin")
@Path("count")
public Response getCount(@CookieParam("user") String userCookie, @Context SecurityContext ctx){
UUID kid = UUID.fromString(jwt.getClaim(Claims.kid));
UsersEntity user = UsersEntity.findById(kid);
Response.Status status = getResponseCheck(ctx, userCookie, user);
Response responseHttp = Response.status(status).build();
if (status.equals(Response.Status.OK)){
responseHttp = Response.ok(UsersEntity.count()).build();
}
return responseHttp;
}
@GET
@RolesAllowed("Admin")
@Path("{id}")