poner seguridad en los show

This commit is contained in:
Abraham 2021-04-03 13:07:51 +02:00
parent e2f4234913
commit e88a992681
4 changed files with 16 additions and 4 deletions

View file

@ -104,13 +104,15 @@ public class FoodOfferController {
public String processShowForm(@PathVariable("foodOfferId") int foodOfferId, Map<String, Object> model) {
FoodOffer foodOffer = this.foodOfferService.findFoodOfferById(foodOfferId);
if(!foodOffer.getStatus().equals(StatusOffer.active)) {
return "error";
}else {
model.put("foodOffer", foodOffer);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/food/foodOffersShow";
}
}
@GetMapping(value = "/offers/food/{foodOfferId}/edit")

View file

@ -133,10 +133,14 @@ public class NuOfferController {
@GetMapping("/offers/nu/{nuOfferId}")
public String processShowForm(@PathVariable("nuOfferId") int nuOfferId, Map<String, Object> model) {
NuOffer nuOffer = this.nuOfferService.findNuOfferById(nuOfferId);
if(!nuOffer.getStatus().equals(StatusOffer.active)) {
return "error";
}else {
model.put("nuOffer", nuOffer);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/nu/nuOffersShow";
}
}

View file

@ -125,12 +125,15 @@ public class SpeedOfferController {
@GetMapping("/offers/speed/{speedOfferId}")
public String processShowForm(@PathVariable("speedOfferId") int speedOfferId, Map<String, Object> model) {
SpeedOffer speedOffer = this.speedOfferService.findSpeedOfferById(speedOfferId);
if(!speedOffer.getStatus().equals(StatusOffer.active)) {
return "error";
}else {
model.put("speedOffer", speedOffer);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/speed/speedOffersShow";
}
}
@GetMapping(value = "/offers/speed/{speedOfferId}/edit")

View file

@ -121,12 +121,15 @@ public class TimeOfferController {
public String processShowForm(@PathVariable("timeOfferId") int timeOfferId, Map<String, Object> model) {
TimeOffer timeOffer = this.timeOfferService.findTimeOfferById(timeOfferId);
if(!timeOffer.getStatus().equals(StatusOffer.active)) {
return "error";
}else {
model.put("timeOffer", timeOffer);
model.put("localDateTimeFormat", DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"));
return "offers/time/timeOffersShow";
}
}