Commit c3cb60cf by Tuomas Riihimäki

Check that returned place belongs to this event

Also unbuying of place should be restricted to MANAGE_OTHERS
1 parent 1c9ac393
...@@ -584,11 +584,26 @@ public class PlaceBean implements PlaceBeanLocal { ...@@ -584,11 +584,26 @@ public class PlaceBean implements PlaceBeanLocal {
@Override @Override
@RolesAllowed(MapPermission.S_VIEW) @RolesAllowed(MapPermission.S_VIEW)
public Place find(int placeId) { public Place find(int placeId) {
return placeFacade.find(placeId); Place ret = placeFacade.find(placeId);
// Check that place belongs to this event before returning it.
if (ret.getProduct() != null) {
if (eventBean.getCurrentEvent().equals(ret.getProduct().getEvent())) {
return ret;
}
return null;
}
if (ret.getMap() != null) {
if (eventBean.getCurrentEvent().equals(ret.getMap().getEvent())) {
return ret;
}
}
return null;
} }
@Override @Override
@RolesAllowed(MapPermission.S_BUY_PLACES) @RolesAllowed(MapPermission.S_MANAGE_OTHERS)
public Place unbuyPlace(Place place) { public Place unbuyPlace(Place place) {
place = placeFacade.reload(place); place = placeFacade.reload(place);
if (place.getGroup() != null) { if (place.getGroup() != null) {
...@@ -806,7 +821,7 @@ public class PlaceBean implements PlaceBeanLocal { ...@@ -806,7 +821,7 @@ public class PlaceBean implements PlaceBeanLocal {
row = placeSlotFacade.reload(row); row = placeSlotFacade.reload(row);
if (row.getPlace() == null && row.getUsed() == null) { if (row.getPlace() == null && row.getUsed() == null) {
row.setUsed(new Date()); row.setUsed(new Date());
}else { } else {
return false; return false;
} }
return true; return true;
...@@ -817,7 +832,7 @@ public class PlaceBean implements PlaceBeanLocal { ...@@ -817,7 +832,7 @@ public class PlaceBean implements PlaceBeanLocal {
row = placeSlotFacade.reload(row); row = placeSlotFacade.reload(row);
if (row.getPlace() == null && row.getUsed() != null) { if (row.getPlace() == null && row.getUsed() != null) {
row.setUsed(null); row.setUsed(null);
}else { } else {
return false; return false;
} }
return true; return true;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!