mirror of
https://github.com/google/nomulus
synced 2026-09-19 06:32:00 +00:00
Allow superuser ext to override client/server transfer prohibited (#2890)
The superuser can remove/add those statuses anyway, so there's not really any point. This also saves us trouble if we need to do a BTAPPA transfer.
This commit is contained in:
@@ -133,10 +133,9 @@ import org.joda.time.DateTime;
|
|||||||
@ReportingSpec(ActivityReportField.DOMAIN_TRANSFER_REQUEST)
|
@ReportingSpec(ActivityReportField.DOMAIN_TRANSFER_REQUEST)
|
||||||
public final class DomainTransferRequestFlow implements MutatingFlow {
|
public final class DomainTransferRequestFlow implements MutatingFlow {
|
||||||
|
|
||||||
private static final ImmutableSet<StatusValue> DISALLOWED_STATUSES = ImmutableSet.of(
|
private static final ImmutableSet<StatusValue> NON_SUPERUSER_DISALLOWED_STATUSES =
|
||||||
StatusValue.CLIENT_TRANSFER_PROHIBITED,
|
ImmutableSet.of(
|
||||||
StatusValue.PENDING_DELETE,
|
StatusValue.CLIENT_TRANSFER_PROHIBITED, StatusValue.SERVER_TRANSFER_PROHIBITED);
|
||||||
StatusValue.SERVER_TRANSFER_PROHIBITED);
|
|
||||||
|
|
||||||
@Inject ResourceCommand resourceCommand;
|
@Inject ResourceCommand resourceCommand;
|
||||||
@Inject ExtensionManager extensionManager;
|
@Inject ExtensionManager extensionManager;
|
||||||
@@ -299,8 +298,9 @@ public final class DomainTransferRequestFlow implements MutatingFlow {
|
|||||||
DateTime now,
|
DateTime now,
|
||||||
Optional<DomainTransferRequestSuperuserExtension> superuserExtension)
|
Optional<DomainTransferRequestSuperuserExtension> superuserExtension)
|
||||||
throws EppException {
|
throws EppException {
|
||||||
verifyNoDisallowedStatuses(existingDomain, DISALLOWED_STATUSES);
|
verifyNoDisallowedStatuses(existingDomain, ImmutableSet.of(StatusValue.PENDING_DELETE));
|
||||||
if (!isSuperuser) {
|
if (!isSuperuser) {
|
||||||
|
verifyNoDisallowedStatuses(existingDomain, NON_SUPERUSER_DISALLOWED_STATUSES);
|
||||||
verifyAuthInfoPresentForResourceTransfer(authInfo);
|
verifyAuthInfoPresentForResourceTransfer(authInfo);
|
||||||
verifyAuthInfo(authInfo.get(), existingDomain);
|
verifyAuthInfo(authInfo.get(), existingDomain);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1004,6 +1004,40 @@ class DomainTransferRequestFlowTest
|
|||||||
ImmutableMap.of("PERIOD", "0", "AUTOMATIC_TRANSFER_LENGTH", "5")));
|
ImmutableMap.of("PERIOD", "0", "AUTOMATIC_TRANSFER_LENGTH", "5")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testSuccess_superuserExtension_clientTransferProhibited() throws Exception {
|
||||||
|
setupDomain("example", "tld");
|
||||||
|
eppRequestSource = EppRequestSource.TOOL;
|
||||||
|
domain =
|
||||||
|
persistResource(
|
||||||
|
domain.asBuilder().addStatusValue(StatusValue.CLIENT_TRANSFER_PROHIBITED).build());
|
||||||
|
doSuccessfulSuperuserExtensionTest(
|
||||||
|
"domain_transfer_request_superuser_extension.xml",
|
||||||
|
"domain_transfer_request_response_su_ext_zero_period_zero_transfer_length.xml",
|
||||||
|
domain.getRegistrationExpirationTime().plusYears(0),
|
||||||
|
ImmutableMap.of("PERIOD", "0", "AUTOMATIC_TRANSFER_LENGTH", "0"),
|
||||||
|
Optional.empty(),
|
||||||
|
Period.create(0, Unit.YEARS),
|
||||||
|
Duration.ZERO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testSuccess_superuserExtension_serverTransferProhibited() throws Exception {
|
||||||
|
setupDomain("example", "tld");
|
||||||
|
eppRequestSource = EppRequestSource.TOOL;
|
||||||
|
domain =
|
||||||
|
persistResource(
|
||||||
|
domain.asBuilder().addStatusValue(StatusValue.SERVER_TRANSFER_PROHIBITED).build());
|
||||||
|
doSuccessfulSuperuserExtensionTest(
|
||||||
|
"domain_transfer_request_superuser_extension.xml",
|
||||||
|
"domain_transfer_request_response_su_ext_zero_period_zero_transfer_length.xml",
|
||||||
|
domain.getRegistrationExpirationTime().plusYears(0),
|
||||||
|
ImmutableMap.of("PERIOD", "0", "AUTOMATIC_TRANSFER_LENGTH", "0"),
|
||||||
|
Optional.empty(),
|
||||||
|
Period.create(0, Unit.YEARS),
|
||||||
|
Duration.ZERO);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSuccess_cappedExpiration() throws Exception {
|
void testSuccess_cappedExpiration() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
@@ -1809,6 +1843,22 @@ class DomainTransferRequestFlowTest
|
|||||||
assertThat(thrown).hasMessageThat().contains("pendingDelete");
|
assertThat(thrown).hasMessageThat().contains("pendingDelete");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testFailure_pendingDelete_evenWhenSuperuser() {
|
||||||
|
setupDomain("example", "tld");
|
||||||
|
eppRequestSource = EppRequestSource.TOOL;
|
||||||
|
domain = persistResource(domain.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build());
|
||||||
|
ResourceStatusProhibitsOperationException thrown =
|
||||||
|
assertThrows(
|
||||||
|
ResourceStatusProhibitsOperationException.class,
|
||||||
|
() ->
|
||||||
|
runTest(
|
||||||
|
"domain_transfer_request_superuser_extension.xml",
|
||||||
|
UserPrivileges.SUPERUSER,
|
||||||
|
ImmutableMap.of("PERIOD", "0", "AUTOMATIC_TRANSFER_LENGTH", "0")));
|
||||||
|
assertThat(thrown).hasMessageThat().contains("pendingDelete");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testIcannActivityReportField_getsLogged() throws Exception {
|
void testIcannActivityReportField_getsLogged() throws Exception {
|
||||||
setupDomain("example", "tld");
|
setupDomain("example", "tld");
|
||||||
|
|||||||
Reference in New Issue
Block a user