Commit 99309154 by Tuomas Riihimäki

Add checking for selecting places

1 parent e0c3d5bf
......@@ -22,6 +22,7 @@ import org.slf4j.LoggerFactory;
import fi.codecrew.moya.beans.PermissionBeanLocal;
import fi.codecrew.moya.beans.PlaceBeanLocal;
import fi.codecrew.moya.beans.QueueBeanLocal;
import fi.codecrew.moya.model.EventMap;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.Place;
......@@ -47,6 +48,9 @@ public class PlacemapRestViewV1 {
@Inject
private UserView userView;
@EJB
private QueueBeanLocal quebean;
// @GET
// @Path("/maps")
// public PlacemapMapRootPojo getMaps()
......@@ -116,6 +120,13 @@ public class PlacemapRestViewV1 {
}
Place p = placebean.find(placeId);
EventMap map = p.getMap();
if (!quebean.isReserving(map, user))
{
logger.warn("User is not in reservation order ");
return Response.status(Response.Status.FORBIDDEN).build();
}
boolean success = false;
if (p.isReservedFor(user)) {
success = placebean.releasePlace(p);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!