Commit 99309154 by Tuomas Riihimäki

Add checking for selecting places

1 parent e0c3d5bf
...@@ -22,6 +22,7 @@ import org.slf4j.LoggerFactory; ...@@ -22,6 +22,7 @@ import org.slf4j.LoggerFactory;
import fi.codecrew.moya.beans.PermissionBeanLocal; import fi.codecrew.moya.beans.PermissionBeanLocal;
import fi.codecrew.moya.beans.PlaceBeanLocal; import fi.codecrew.moya.beans.PlaceBeanLocal;
import fi.codecrew.moya.beans.QueueBeanLocal;
import fi.codecrew.moya.model.EventMap; import fi.codecrew.moya.model.EventMap;
import fi.codecrew.moya.model.EventUser; import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.Place; import fi.codecrew.moya.model.Place;
...@@ -47,6 +48,9 @@ public class PlacemapRestViewV1 { ...@@ -47,6 +48,9 @@ public class PlacemapRestViewV1 {
@Inject @Inject
private UserView userView; private UserView userView;
@EJB
private QueueBeanLocal quebean;
// @GET // @GET
// @Path("/maps") // @Path("/maps")
// public PlacemapMapRootPojo getMaps() // public PlacemapMapRootPojo getMaps()
...@@ -116,6 +120,13 @@ public class PlacemapRestViewV1 { ...@@ -116,6 +120,13 @@ public class PlacemapRestViewV1 {
} }
Place p = placebean.find(placeId); 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; boolean success = false;
if (p.isReservedFor(user)) { if (p.isReservedFor(user)) {
success = placebean.releasePlace(p); 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!