mirror of
https://github.com/google/nomulus.git
synced 2025-05-28 16:30:12 +02:00
Allow the same LaunchPhase to be used for both start-date and end-date sunrise
Also changed the name of "verifyRegistryStateAllowsLaunchFlows" to "verifyRegistryStateAllowsApplicationFlows", because there are now launch flows that don't use applications (start-date sunrise). Finally, added a test to showcase the "super-user" power that EPPs with Anchor Tenants have. There's no change in behavior in that regard in this CL - we just add a test to make it explicit. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=187517199
This commit is contained in:
parent
ef26dabf32
commit
24799b394d
11 changed files with 36 additions and 26 deletions
|
@ -37,7 +37,7 @@ import static google.registry.flows.domain.DomainFlowUtils.verifyNoCodeMarks;
|
|||
import static google.registry.flows.domain.DomainFlowUtils.verifyNotReserved;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.verifyPremiumNameIsNotBlocked;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.verifyRegistrarIsActive;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.verifyRegistryStateAllowsLaunchFlows;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.verifyRegistryStateAllowsApplicationFlows;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.verifyUnitIsYears;
|
||||
import static google.registry.model.EppResourceUtils.createDomainRepoId;
|
||||
import static google.registry.model.index.DomainApplicationIndex.loadActiveApplicationsByDomainName;
|
||||
|
@ -320,7 +320,7 @@ public final class DomainApplicationCreateFlow implements TransactionalFlow {
|
|||
}
|
||||
boolean isSunriseApplication = !launchCreate.getSignedMarks().isEmpty();
|
||||
if (!isSuperuser) { // Superusers can ignore the phase.
|
||||
verifyRegistryStateAllowsLaunchFlows(registry, now);
|
||||
verifyRegistryStateAllowsApplicationFlows(registry, now);
|
||||
verifyLaunchPhaseMatchesRegistryPhase(registry, launchCreate, now);
|
||||
}
|
||||
if (now.isBefore(registry.getClaimsPeriodEnd())) {
|
||||
|
|
|
@ -22,7 +22,7 @@ import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
|
|||
import static google.registry.flows.domain.DomainFlowUtils.checkAllowedAccessToTld;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.verifyApplicationDomainMatchesTargetId;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.verifyLaunchPhaseMatchesRegistryPhase;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.verifyRegistryStateAllowsLaunchFlows;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.verifyRegistryStateAllowsApplicationFlows;
|
||||
import static google.registry.model.EppResourceUtils.loadDomainApplication;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
|
||||
|
@ -91,7 +91,7 @@ public final class DomainApplicationDeleteFlow implements TransactionalFlow {
|
|||
if (!isSuperuser) {
|
||||
checkAllowedAccessToTld(clientId, tld);
|
||||
Registry registry = Registry.get(tld);
|
||||
verifyRegistryStateAllowsLaunchFlows(registry, now);
|
||||
verifyRegistryStateAllowsApplicationFlows(registry, now);
|
||||
verifyLaunchPhaseMatchesRegistryPhase(
|
||||
registry, eppInput.getSingleExtension(LaunchDeleteExtension.class).get(), now);
|
||||
verifyResourceOwnership(clientId, existingApplication);
|
||||
|
|
|
@ -118,7 +118,6 @@ import java.util.Comparator;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -130,14 +129,14 @@ import org.joda.time.Duration;
|
|||
/** Static utility functions for domain flows. */
|
||||
public class DomainFlowUtils {
|
||||
|
||||
/** Map from launch phases to the equivalent tld states. */
|
||||
private static final ImmutableMap<LaunchPhase, TldState> LAUNCH_PHASE_TO_TLD_STATE =
|
||||
new ImmutableMap.Builder<LaunchPhase, TldState>()
|
||||
/** Map from launch phases to the allowed tld states. */
|
||||
private static final ImmutableMultimap<LaunchPhase, TldState> LAUNCH_PHASE_TO_TLD_STATES =
|
||||
new ImmutableMultimap.Builder<LaunchPhase, TldState>()
|
||||
.put(LaunchPhase.SUNRISE, TldState.SUNRISE)
|
||||
.put(LaunchPhase.SUNRUSH, TldState.SUNRUSH)
|
||||
.put(LaunchPhase.LANDRUSH, TldState.LANDRUSH)
|
||||
.put(LaunchPhase.CLAIMS, TldState.GENERAL_AVAILABILITY)
|
||||
.put(LaunchPhase.START_DATE_SUNRISE, TldState.START_DATE_SUNRISE)
|
||||
.put(LaunchPhase.SUNRISE, TldState.START_DATE_SUNRISE)
|
||||
.put(LaunchPhase.OPEN, TldState.GENERAL_AVAILABILITY)
|
||||
.build();
|
||||
|
||||
|
@ -149,7 +148,7 @@ public class DomainFlowUtils {
|
|||
ReservationType.MISTAKEN_PREMIUM);
|
||||
|
||||
/** Non-sunrise tld states. */
|
||||
private static final ImmutableSet<TldState> DISALLOWED_TLD_STATES_FOR_LAUNCH_FLOWS =
|
||||
private static final ImmutableSet<TldState> DISALLOWED_TLD_STATES_FOR_APPLICATION_FLOWS =
|
||||
Sets.immutableEnumSet(
|
||||
TldState.PREDELEGATION,
|
||||
TldState.QUIET_PERIOD,
|
||||
|
@ -421,8 +420,8 @@ public class DomainFlowUtils {
|
|||
/** Verifies that a launch extension's specified phase matches the specified registry's phase. */
|
||||
static void verifyLaunchPhaseMatchesRegistryPhase(
|
||||
Registry registry, LaunchExtension launchExtension, DateTime now) throws EppException {
|
||||
if (!Objects.equals(
|
||||
registry.getTldState(now), LAUNCH_PHASE_TO_TLD_STATE.get(launchExtension.getPhase()))) {
|
||||
if (!LAUNCH_PHASE_TO_TLD_STATES.containsEntry(
|
||||
launchExtension.getPhase(), registry.getTldState(now))) {
|
||||
// No launch operations are allowed during the quiet period or predelegation.
|
||||
throw new LaunchPhaseMismatchException();
|
||||
}
|
||||
|
@ -843,9 +842,9 @@ public class DomainFlowUtils {
|
|||
}
|
||||
|
||||
/** Check that the registry phase is not incompatible with launch extension flows. */
|
||||
static void verifyRegistryStateAllowsLaunchFlows(Registry registry, DateTime now)
|
||||
static void verifyRegistryStateAllowsApplicationFlows(Registry registry, DateTime now)
|
||||
throws BadCommandForRegistryPhaseException {
|
||||
if (DISALLOWED_TLD_STATES_FOR_LAUNCH_FLOWS.contains(registry.getTldState(now))) {
|
||||
if (DISALLOWED_TLD_STATES_FOR_APPLICATION_FLOWS.contains(registry.getTldState(now))) {
|
||||
throw new BadCommandForRegistryPhaseException();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,6 +58,10 @@ public class LaunchPhase extends ImmutableObject {
|
|||
/**
|
||||
* The phase during which trademark holders can submit registrations or applications with
|
||||
* trademark information that can be validated by the server.
|
||||
*
|
||||
* This phase works for both start-date and end-data sunrise.
|
||||
*
|
||||
* TODO(b/74006379): maybe make this work for sunrush phase?
|
||||
*/
|
||||
public static final LaunchPhase SUNRISE = create("sunrise", null);
|
||||
|
||||
|
@ -76,12 +80,6 @@ public class LaunchPhase extends ImmutableObject {
|
|||
*/
|
||||
public static final LaunchPhase CLAIMS = create("claims", null);
|
||||
|
||||
/**
|
||||
* An alternative launch phase which allows only trademark owners to create domains. It is used
|
||||
* instead of the previous phases.
|
||||
*/
|
||||
public static final LaunchPhase START_DATE_SUNRISE = create("sunrise", "start-date");
|
||||
|
||||
/** A post-launch phase that is also referred to as "steady state". */
|
||||
public static final LaunchPhase OPEN = create("open", null);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue