Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,9 @@
@ReportingSpec(ActivityReportField.DOMAIN_TRANSFER_REQUEST)
public final class DomainTransferRequestFlow implements MutatingFlow {

private static final ImmutableSet<StatusValue> DISALLOWED_STATUSES = ImmutableSet.of(
StatusValue.CLIENT_TRANSFER_PROHIBITED,
StatusValue.PENDING_DELETE,
StatusValue.SERVER_TRANSFER_PROHIBITED);
private static final ImmutableSet<StatusValue> NON_SUPERUSER_DISALLOWED_STATUSES =
ImmutableSet.of(
StatusValue.CLIENT_TRANSFER_PROHIBITED, StatusValue.SERVER_TRANSFER_PROHIBITED);

@Inject ResourceCommand resourceCommand;
@Inject ExtensionManager extensionManager;
Expand Down Expand Up @@ -299,8 +298,9 @@ private void verifyTransferAllowed(
DateTime now,
Optional<DomainTransferRequestSuperuserExtension> superuserExtension)
throws EppException {
verifyNoDisallowedStatuses(existingDomain, DISALLOWED_STATUSES);
verifyNoDisallowedStatuses(existingDomain, ImmutableSet.of(StatusValue.PENDING_DELETE));
if (!isSuperuser) {
verifyNoDisallowedStatuses(existingDomain, NON_SUPERUSER_DISALLOWED_STATUSES);
verifyAuthInfoPresentForResourceTransfer(authInfo);
verifyAuthInfo(authInfo.get(), existingDomain);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,40 @@ void testFailure_superuserExtension_zeroPeriod_feeTransferExtension() {
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
void testSuccess_cappedExpiration() throws Exception {
setupDomain("example", "tld");
Expand Down Expand Up @@ -1809,6 +1843,22 @@ void testFailure_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
void testIcannActivityReportField_getsLogged() throws Exception {
setupDomain("example", "tld");
Expand Down
Loading