コード例 #1
0
 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())));
 }
コード例 #2
0
 public boolean canEditBooking(User user, long bookingId) {
   Booking booking = bookings.findOne(bookingId);
   return booking != null
       && booking.getGuest() != null
       && user.getUsername().equals(booking.getGuest().getEmail());
 }