Allow reserved domains to be created during quiet periods

We'll use this for LRP. This is safe because we must specifically reserve a
domain by including it in a reserved list, create an associated allocation
token, and distribute that token, before a create would succeed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=250901144
This commit is contained in:
mcilwain 2019-05-31 09:38:18 -07:00 committed by Ben McIlwain
parent 79bcb227be
commit ff6d327183
2 changed files with 39 additions and 3 deletions

View file

@ -44,6 +44,7 @@ import static google.registry.model.EppResourceUtils.createDomainRepoId;
import static google.registry.model.eppcommon.StatusValue.SERVER_HOLD;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.registry.Registry.TldState.GENERAL_AVAILABILITY;
import static google.registry.model.registry.Registry.TldState.QUIET_PERIOD;
import static google.registry.model.registry.Registry.TldState.START_DATE_SUNRISE;
import static google.registry.model.registry.label.ReservationType.NAME_COLLISION;
import static google.registry.util.DateTimeUtils.END_OF_TIME;
@ -254,11 +255,12 @@ public class DomainCreateFlow implements TransactionalFlow {
// registering premium domains.
if (!isSuperuser) {
checkAllowedAccessToTld(clientId, registry.getTldStr());
verifyIsGaOrIsSpecialCase(tldState, isAnchorTenant, hasSignedMarks);
boolean isValidReservedCreate = isValidReservedCreate(domainName, allocationToken);
verifyIsGaOrIsSpecialCase(tldState, isAnchorTenant, isValidReservedCreate, hasSignedMarks);
if (launchCreate.isPresent()) {
verifyLaunchPhaseMatchesRegistryPhase(registry, launchCreate.get(), now);
}
if (!isAnchorTenant && !isValidReservedCreate(domainName, allocationToken)) {
if (!isAnchorTenant && !isValidReservedCreate) {
verifyNotReserved(domainName, isSunriseCreate);
}
if (hasClaimsNotice) {
@ -423,7 +425,10 @@ public class DomainCreateFlow implements TransactionalFlow {
* non-superusers.
*/
private void verifyIsGaOrIsSpecialCase(
TldState tldState, boolean isAnchorTenant, boolean hasSignedMarks)
TldState tldState,
boolean isAnchorTenant,
boolean isValidReservedCreate,
boolean hasSignedMarks)
throws NoGeneralRegistrationsInCurrentPhaseException,
MustHaveSignedMarksInCurrentPhaseException {
// Anchor Tenant overrides any other consideration to allow registration.
@ -444,6 +449,13 @@ public class DomainCreateFlow implements TransactionalFlow {
return;
}
// We allow creates of specifically reserved domain names during quiet periods.
if (QUIET_PERIOD.equals(tldState)) {
if (isValidReservedCreate) {
return;
}
}
// All other phases do not allow registration
throw new NoGeneralRegistrationsInCurrentPhaseException();
}