Skip to content
Snippets Groups Projects

feat: Add endpoint to check user ECA status via email

All threads resolved!
2 files
+ 51
1
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -13,6 +13,7 @@ import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
@@ -43,6 +44,7 @@ import org.eclipsefoundation.git.eca.namespace.ProviderType;
import org.eclipsefoundation.git.eca.service.ProjectsService;
import org.eclipsefoundation.git.eca.service.UserService;
import org.eclipsefoundation.git.eca.service.ValidationService;
import org.jboss.resteasy.annotations.jaxrs.QueryParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -54,7 +56,7 @@ import io.quarkus.qute.Template;
* commits passed to this endpoint. Should be as system agnostic as possible to allow for any service to request
* validation with less reliance on services external to the Eclipse foundation.
*
* @author Martin Lowe
* @author Martin Lowe, Zachary Sabourin
*/
@Path("/eca")
@Consumes({ MediaType.APPLICATION_JSON })
@@ -159,6 +161,23 @@ public class ValidationResource {
membershipTemplateWeb.data("statuses", statuses, "repoUrl", statuses.get(0).getRepoUrl()).render())
.build();
}
@GET
@Path("/lookup")
public Response getUserStatus(@QueryParam("email") String email) {
EclipseUser user = users.getUser(email);
if (Objects.isNull(user)) {
return Response.status(404).build();
}
if(!user.getECA().getSigned()) {
return Response.status(403).build();
}
return Response.ok().build();
}
/**
* Check if there are any issues with the validation request, returning error messages if there are issues with the
Loading