i18n.tr("Please supply a valid guest id"));
}
if (updated == null) {
// If they're not sending attributes, we can get the guestId from the url
updated = new GuestId(guestId);
}
// Allow the id to be left out in this case, we can use the path param
if (updated.getGuestId() == null) {
updated.setGuestId(guestId);
}
// If the guest uuids do not match, something is wrong
if (!guestId.equalsIgnoreCase(updated.getGuestId())) {
throw new BadRequestException(
i18n.tr("Guest ID in json \"{0}\" does not match path guest ID \"{1}\"",
updated.getGuestId(), guestId));
}
Consumer consumer = consumerCurator.verifyAndLookupConsumer(consumerUuid);
updated.setConsumer(consumer);
GuestId toUpdate =
guestIdCurator.findByGuestIdAndOrg(guestId, consumer.getOwner());
// If this guest has a consumer, we want to remove host-specific entitlements
if (toUpdate != null) {
revokeBadHostRestrictedEnts(toUpdate, consumer);
updated.setId(toUpdate.getId());
}
guestIdCurator.merge(updated);
}