preparations: removed useless endpoint and added security for docker endpoints

This commit is contained in:
Arthur Wambst 2025-10-20 17:25:37 +02:00
parent 3e2ebac614
commit a8703ca940
No known key found for this signature in database

View File

@ -1,6 +1,8 @@
package fr.la_banquise.backend.rest;
import fr.la_banquise.backend.services.DockerService;
import io.quarkus.security.jpa.Roles;
import jakarta.annotation.security.RolesAllowed;
import jakarta.inject.Inject;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
@ -14,7 +16,7 @@ public class DockerResource {
@Inject DockerService dockerService;
@POST
/*@POST
@Path("/nginx")
public Response launchNginx() {
try {
@ -40,9 +42,10 @@ public class DockerResource {
.entity(Map.of("error", e.getMessage()))
.build();
}
}
}*/
@GET
@RolesAllowed("ROOT")
@Path("/all")
public Response listContainers() {
try {
@ -55,6 +58,7 @@ public class DockerResource {
}
@POST
@RolesAllowed("ROOT")
@Path("/start")
public Response start(@QueryParam("id") String id) {
try {
@ -69,6 +73,7 @@ public class DockerResource {
}
@POST
@RolesAllowed("ROOT")
@Path("/stop")
public Response stop(@QueryParam("id") String id) {
try {
@ -82,6 +87,7 @@ public class DockerResource {
}
}
@DELETE
@RolesAllowed("ROOT")
@Path("/remove")
public Response remove(@QueryParam("id") String id) {
try {