public boolean canDeleteBooking(User user, long bookingId) { Booking booking = bookings.findOne(bookingId); return booking != null && ((booking.getGuest() != null && user.getUsername().equals(booking.getGuest().getEmail())) || (booking.getHotel() != null && booking.getHotel().getManager() != null && user.getUsername().equals(booking.getHotel().getManager().getEmail()))); }
public boolean canEditBooking(User user, long bookingId) { Booking booking = bookings.findOne(bookingId); return booking != null && booking.getGuest() != null && user.getUsername().equals(booking.getGuest().getEmail()); }