Skip to content

Commit 847ef12

Browse files
authored
Remove Tld.allowedRegistrantContactIds field (#2867)
We no longer need this now that no contacts can be applied to any domains at all. A follow-up PR in subsequent weeks will delete the column from the DB schema. BUG= http://b/448619572
1 parent d9349be commit 847ef12

File tree

23 files changed

+0
-151
lines changed

23 files changed

+0
-151
lines changed

core/src/main/java/google/registry/config/files/tld/example.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
addGracePeriodLength: "PT432000S"
77
allowedFullyQualifiedHostNames: []
8-
allowedRegistrantContactIds: []
98
anchorTenantAddGracePeriodLength: "PT2592000S"
109
autoRenewGracePeriodLength: "PT3888000S"
1110
automaticTransferLength: "PT432000S"

core/src/main/java/google/registry/flows/domain/DomainCreateFlow.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@
195195
* @error {@link DomainFlowUtils.NameserversNotAllowedForTldException}
196196
* @error {@link DomainFlowUtils.NameserversNotSpecifiedForTldWithNameserverAllowListException}
197197
* @error {@link DomainFlowUtils.PremiumNameBlockedException}
198-
* @error {@link DomainFlowUtils.RegistrantNotAllowedException}
199198
* @error {@link RegistrantProhibitedException}
200199
* @error {@link DomainFlowUtils.RegistrarMustBeActiveForThisOperationException}
201200
* @error {@link DomainFlowUtils.TldDoesNotExistException}

core/src/main/java/google/registry/flows/domain/DomainFlowUtils.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -553,17 +553,6 @@ static void validateUpdateContactData(
553553
}
554554
}
555555

556-
static void validateRegistrantAllowedOnTld(String tld, Optional<String> registrantContactId)
557-
throws RegistrantNotAllowedException {
558-
ImmutableSet<String> allowedRegistrants = Tld.get(tld).getAllowedRegistrantContactIds();
559-
// Empty allow list or null registrantContactId are ignored.
560-
if (registrantContactId.isPresent()
561-
&& !allowedRegistrants.isEmpty()
562-
&& !allowedRegistrants.contains(registrantContactId.get())) {
563-
throw new RegistrantNotAllowedException(registrantContactId.get());
564-
}
565-
}
566-
567556
static void validateNameserversAllowedOnTld(String tld, Set<String> fullyQualifiedHostNames)
568557
throws EppException {
569558
ImmutableSet<String> allowedHostNames = Tld.get(tld).getAllowedFullyQualifiedHostNames();
@@ -1091,7 +1080,6 @@ static void validateCreateCommandContactsAndNameservers(
10911080
command.getContacts(), command.getRegistrant(), command.getNameservers());
10921081
validateContactsHaveTypes(command.getContacts());
10931082
String tldStr = tld.getTldStr();
1094-
validateRegistrantAllowedOnTld(tldStr, command.getRegistrantContactId());
10951083
validateNoDuplicateContacts(command.getContacts());
10961084
validateCreateContactData(command.getRegistrant(), command.getContacts());
10971085
ImmutableSet<String> hostNames = command.getNameserverHostNames();
@@ -1630,13 +1618,6 @@ public MissingBillingAccountMapException(CurrencyUnit currency) {
16301618
}
16311619
}
16321620

1633-
/** Registrant is not allow-listed for this TLD. */
1634-
public static class RegistrantNotAllowedException extends StatusProhibitsOperationException {
1635-
public RegistrantNotAllowedException(String contactId) {
1636-
super(String.format("Registrant with id %s is not allow-listed for this TLD", contactId));
1637-
}
1638-
}
1639-
16401621
/** Nameservers are not allow-listed for this TLD. */
16411622
public static class NameserversNotAllowedForTldException
16421623
extends StatusProhibitsOperationException {

core/src/main/java/google/registry/flows/domain/DomainUpdateFlow.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import static google.registry.flows.domain.DomainFlowUtils.validateNameserversAllowedOnTld;
3737
import static google.registry.flows.domain.DomainFlowUtils.validateNameserversCountForTld;
3838
import static google.registry.flows.domain.DomainFlowUtils.validateNoDuplicateContacts;
39-
import static google.registry.flows.domain.DomainFlowUtils.validateRegistrantAllowedOnTld;
4039
import static google.registry.flows.domain.DomainFlowUtils.validateUpdateContactData;
4140
import static google.registry.flows.domain.DomainFlowUtils.verifyClientUpdateNotProhibited;
4241
import static google.registry.flows.domain.DomainFlowUtils.verifyNotInPendingDelete;
@@ -131,7 +130,6 @@
131130
* @error {@link DomainFlowUtils.NameserversNotAllowedForTldException}
132131
* @error {@link NameserversNotSpecifiedForTldWithNameserverAllowListException}
133132
* @error {@link DomainFlowUtils.NotAuthorizedForTldException}
134-
* @error {@link DomainFlowUtils.RegistrantNotAllowedException}
135133
* @error {@link RegistrantProhibitedException}
136134
* @error {@link DomainFlowUtils.SecDnsAllUsageException}
137135
* @error {@link DomainFlowUtils.TooManyDsRecordsException}
@@ -248,7 +246,6 @@ private void verifyUpdateAllowed(Update command, Domain existingDomain, DateTime
248246
add.getNameservers());
249247
validateContactsHaveTypes(add.getContacts());
250248
validateContactsHaveTypes(remove.getContacts());
251-
validateRegistrantAllowedOnTld(tldStr, command.getInnerChange().getRegistrantContactId());
252249
validateNameserversAllowedOnTld(tldStr, add.getNameserverHostNames());
253250
}
254251

core/src/main/java/google/registry/model/tld/Tld.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -521,11 +521,6 @@ public ImmutableSet<String> getReservedListNames() {
521521
@Column(nullable = false)
522522
DateTime claimsPeriodEnd = END_OF_TIME;
523523

524-
/** An allowlist of clients allowed to be used on domains on this TLD (ignored if empty). */
525-
@Nullable
526-
@JsonSerialize(using = SortedSetSerializer.class)
527-
Set<String> allowedRegistrantContactIds;
528-
529524
/** An allowlist of hosts allowed to be used on domains on this TLD (ignored if empty). */
530525
@Nullable
531526
@JsonSerialize(using = SortedSetSerializer.class)
@@ -786,10 +781,6 @@ public String getTldUnicode() {
786781
return tldUnicode;
787782
}
788783

789-
public ImmutableSet<String> getAllowedRegistrantContactIds() {
790-
return nullToEmptyImmutableCopy(allowedRegistrantContactIds);
791-
}
792-
793784
public ImmutableSet<String> getAllowedFullyQualifiedHostNames() {
794785
return nullToEmptyImmutableCopy(allowedFullyQualifiedHostNames);
795786
}
@@ -1077,12 +1068,6 @@ public Builder setClaimsPeriodEnd(DateTime claimsPeriodEnd) {
10771068
return this;
10781069
}
10791070

1080-
public Builder setAllowedRegistrantContactIds(
1081-
ImmutableSet<String> allowedRegistrantContactIds) {
1082-
getInstance().allowedRegistrantContactIds = allowedRegistrantContactIds;
1083-
return this;
1084-
}
1085-
10861071
public Builder setAllowedFullyQualifiedHostNames(
10871072
ImmutableSet<String> allowedFullyQualifiedHostNames) {
10881073
getInstance().allowedFullyQualifiedHostNames = allowedFullyQualifiedHostNames;

core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@
133133
import google.registry.flows.domain.DomainFlowUtils.NameserversNotSpecifiedForTldWithNameserverAllowListException;
134134
import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException;
135135
import google.registry.flows.domain.DomainFlowUtils.PremiumNameBlockedException;
136-
import google.registry.flows.domain.DomainFlowUtils.RegistrantNotAllowedException;
137136
import google.registry.flows.domain.DomainFlowUtils.RegistrantProhibitedException;
138137
import google.registry.flows.domain.DomainFlowUtils.RegistrarMustBeActiveForThisOperationException;
139138
import google.registry.flows.domain.DomainFlowUtils.TldDoesNotExistException;
@@ -2839,20 +2838,6 @@ void testFailure_missingBillingAccountMap() {
28392838
assertAboutEppExceptions().that(thrown).marshalsToXml();
28402839
}
28412840

2842-
@Test
2843-
void testFailure_registrantNotAllowListed() {
2844-
persistActiveContact("someone");
2845-
persistContactsAndHosts();
2846-
persistResource(
2847-
Tld.get("tld")
2848-
.asBuilder()
2849-
.setAllowedRegistrantContactIds(ImmutableSet.of("someone"))
2850-
.build());
2851-
RegistrantNotAllowedException thrown =
2852-
assertThrows(RegistrantNotAllowedException.class, this::runFlow);
2853-
assertThat(thrown).hasMessageThat().contains("jd1234");
2854-
}
2855-
28562841
@Test
28572842
void testFailure_nameserverNotAllowListed() {
28582843
persistContactsAndHosts();
@@ -2881,19 +2866,6 @@ void testFailure_emptyNameserverFailsAllowList() {
28812866
assertAboutEppExceptions().that(thrown).marshalsToXml();
28822867
}
28832868

2884-
@Test
2885-
void testSuccess_nameserverAndRegistrantAllowListed() throws Exception {
2886-
persistResource(
2887-
Tld.get("tld")
2888-
.asBuilder()
2889-
.setAllowedRegistrantContactIds(ImmutableSet.of("jd1234"))
2890-
.setAllowedFullyQualifiedHostNames(
2891-
ImmutableSet.of("ns1.example.net", "ns2.example.net"))
2892-
.build());
2893-
persistContactsAndHosts();
2894-
doSuccessfulTest();
2895-
}
2896-
28972869
@Test
28982870
void testFailure_eapFee_combined() {
28992871
setEppInput("domain_create_eap_combined_fee.xml", ImmutableMap.of("FEE_VERSION", "0.6"));

core/src/test/java/google/registry/flows/domain/DomainUpdateFlowTest.java

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
import google.registry.flows.domain.DomainFlowUtils.NameserversNotAllowedForTldException;
9090
import google.registry.flows.domain.DomainFlowUtils.NameserversNotSpecifiedForTldWithNameserverAllowListException;
9191
import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException;
92-
import google.registry.flows.domain.DomainFlowUtils.RegistrantNotAllowedException;
9392
import google.registry.flows.domain.DomainFlowUtils.RegistrantProhibitedException;
9493
import google.registry.flows.domain.DomainFlowUtils.SecDnsAllUsageException;
9594
import google.registry.flows.domain.DomainFlowUtils.TooManyDsRecordsException;
@@ -1713,20 +1712,6 @@ void testFailure_addPendingDeleteHost() throws Exception {
17131712
assertThat(thrown).hasMessageThat().contains("ns2.example.foo");
17141713
}
17151714

1716-
@Test
1717-
void testFailure_newRegistrantNotAllowListed() throws Exception {
1718-
persistReferencedEntities();
1719-
persistDomain();
1720-
persistResource(
1721-
Tld.get("tld")
1722-
.asBuilder()
1723-
.setAllowedRegistrantContactIds(ImmutableSet.of("contact1234"))
1724-
.build());
1725-
clock.advanceOneMilli();
1726-
EppException thrown = assertThrows(RegistrantNotAllowedException.class, this::runFlow);
1727-
assertAboutEppExceptions().that(thrown).marshalsToXml();
1728-
}
1729-
17301715
@Test
17311716
void testFailure_addedNameserverDisallowedInTld() throws Exception {
17321717
persistReferencedEntities();
@@ -1742,44 +1727,6 @@ void testFailure_addedNameserverDisallowedInTld() throws Exception {
17421727
assertAboutEppExceptions().that(thrown).marshalsToXml();
17431728
}
17441729

1745-
@Test
1746-
void testSuccess_newNameserverAllowListed() throws Exception {
1747-
setEppInput("domain_update_add_nameserver.xml");
1748-
persistReferencedEntities();
1749-
persistDomain();
1750-
// No registrant is given but both nameserver and registrant allow list exist.
1751-
persistResource(
1752-
Tld.get("tld")
1753-
.asBuilder()
1754-
.setAllowedRegistrantContactIds(ImmutableSet.of("sh8013"))
1755-
.setAllowedFullyQualifiedHostNames(
1756-
ImmutableSet.of("ns1.example.foo", "ns2.example.foo"))
1757-
.build());
1758-
assertThat(reloadResourceByForeignKey().getNameservers())
1759-
.doesNotContain(
1760-
loadResource(Host.class, "ns2.example.foo", clock.nowUtc()).get().createVKey());
1761-
runFlow();
1762-
assertThat(reloadResourceByForeignKey().getNameservers())
1763-
.contains(loadResource(Host.class, "ns2.example.foo", clock.nowUtc()).get().createVKey());
1764-
}
1765-
1766-
@Test
1767-
void testSuccess_changeRegistrantAllowListed() throws Exception {
1768-
setEppInput("domain_update_registrant.xml");
1769-
persistReferencedEntities();
1770-
persistDomain();
1771-
// Only changes registrant, with both nameserver and registrant allow list on the TLD.
1772-
persistResource(
1773-
Tld.get("tld")
1774-
.asBuilder()
1775-
.setAllowedRegistrantContactIds(ImmutableSet.of("sh8013"))
1776-
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
1777-
.build());
1778-
runFlow();
1779-
assertThat(loadByKey(reloadResourceByForeignKey().getRegistrant().get()).getContactId())
1780-
.isEqualTo("sh8013");
1781-
}
1782-
17831730
@Test
17841731
void testSuccess_changeContactsAndRegistrant() throws Exception {
17851732
setEppInput("domain_update_contacts_and_registrant.xml");
@@ -1805,19 +1752,6 @@ void testSuccess_changeContactsAndRegistrant() throws Exception {
18051752
.isEqualTo("sh8013");
18061753
}
18071754

1808-
@Test
1809-
void testSuccess_nameserverAndRegistrantAllowListed() throws Exception {
1810-
persistReferencedEntities();
1811-
persistDomain();
1812-
persistResource(
1813-
Tld.get("tld")
1814-
.asBuilder()
1815-
.setAllowedRegistrantContactIds(ImmutableSet.of("sh8013"))
1816-
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.foo"))
1817-
.build());
1818-
doSuccessfulTest();
1819-
}
1820-
18211755
@Test
18221756
void testSuccess_tldWithNameserverAllowList_removeNameserver() throws Exception {
18231757
setEppInput("domain_update_remove_nameserver.xml");

core/src/test/java/google/registry/model/tld/TldTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,13 @@ void compareTlds(Tld existingTld, Tld constructedTld) {
186186
"dnsWriters",
187187
"idnTables",
188188
"reservedListNames",
189-
"allowedRegistrantContactIds",
190189
"allowedFullyQualifiedHostNames",
191190
"defaultPromoTokens");
192191
assertThat(constructedTld.getDnsWriters())
193192
.containsExactlyElementsIn(existingTld.getDnsWriters());
194193
assertThat(constructedTld.getIdnTables()).containsExactlyElementsIn(existingTld.getIdnTables());
195194
assertThat(constructedTld.getReservedListNames())
196195
.containsExactlyElementsIn(existingTld.getReservedListNames());
197-
assertThat(constructedTld.getAllowedRegistrantContactIds())
198-
.containsExactlyElementsIn(existingTld.getAllowedRegistrantContactIds());
199196
assertThat(constructedTld.getAllowedFullyQualifiedHostNames())
200197
.containsExactlyElementsIn(existingTld.getAllowedFullyQualifiedHostNames());
201198
assertThat(constructedTld.getDefaultPromoTokens())

core/src/test/resources/google/registry/model/tld/tld.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
addGracePeriodLength: "PT432000S"
22
allowedFullyQualifiedHostNames:
33
- "foo"
4-
allowedRegistrantContactIds: []
54
anchorTenantAddGracePeriodLength: "PT2592000S"
65
autoRenewGracePeriodLength: "PT3888000S"
76
automaticTransferLength: "PT432000S"

core/src/test/resources/google/registry/tools/1tld.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
addGracePeriodLength: "PT2592000S"
22
allowedFullyQualifiedHostNames: []
3-
allowedRegistrantContactIds: []
43
anchorTenantAddGracePeriodLength: "PT2592000S"
54
autoRenewGracePeriodLength: "PT2592000S"
65
automaticTransferLength: "PT2592000S"

0 commit comments

Comments
 (0)