Fix bug which allowed creation of hosts with superordinate domains in pending delete state.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154716883
This commit is contained in:
mountford 2017-05-01 08:08:14 -07:00 committed by Ben McIlwain
parent 386d2bc6be
commit 11e7374c0f
7 changed files with 82 additions and 0 deletions

View file

@ -30,7 +30,9 @@ import google.registry.flows.EppException.ObjectDoesNotExistException;
import google.registry.flows.EppException.ParameterValuePolicyErrorException;
import google.registry.flows.EppException.ParameterValueRangeErrorException;
import google.registry.flows.EppException.ParameterValueSyntaxErrorException;
import google.registry.flows.EppException.StatusProhibitsOperationException;
import google.registry.model.domain.DomainResource;
import google.registry.model.eppcommon.StatusValue;
import google.registry.util.Idn;
import org.joda.time.DateTime;
@ -127,6 +129,24 @@ public class HostFlowUtils {
}
}
/** Ensure that the superordinate domain is not in pending delete. */
static void verifySuperordinateDomainNotInPendingDelete(
DomainResource superordinateDomain) throws EppException {
if ((superordinateDomain != null)
&& superordinateDomain.getStatusValues().contains(StatusValue.PENDING_DELETE)) {
throw new SuperordinateDomainInPendingDeleteException(
superordinateDomain.getFullyQualifiedDomainName());
}
}
/** Superordinate domain for this hostname is in pending delete. */
static class SuperordinateDomainInPendingDeleteException
extends StatusProhibitsOperationException {
public SuperordinateDomainInPendingDeleteException(String domainName) {
super(domainName);
}
}
/** Host names are limited to 253 characters. */
static class HostNameTooLongException extends ParameterValueRangeErrorException {
public HostNameTooLongException() {