Skip to content

Commit 88906f1

Browse files
authored
Remove more references to contacts in infrastructure (#2950)
This is a bit scattered, but we remove contact references from domain commands, RDAP, and a bit of config infrastructure.
1 parent bca05f3 commit 88906f1

35 files changed

+52
-807
lines changed

core/src/main/java/google/registry/config/RegistryConfig.java

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,15 @@ public static String provideProductName(RegistryConfigSettings config) {
143143
}
144144

145145
/**
146-
* Returns the roid suffix to be used for the roids of all contacts and hosts. E.g. a value of
147-
* "ROID" would end up creating roids that look like "ABC123-ROID".
146+
* Returns the roid suffix to be used for the roids of all hosts. E.g. a value of "ROID" would
147+
* end up creating roids that look like "ABC123-ROID".
148148
*
149149
* @see <a href="http://www.iana.org/assignments/epp-repository-ids/epp-repository-ids.xhtml">
150150
* Extensible Provisioning Protocol (EPP) Repository Identifiers</a>
151151
*/
152152
@Provides
153-
@Config("contactAndHostRoidSuffix")
154-
public static String provideContactAndHostRoidSuffix(RegistryConfigSettings config) {
153+
@Config("hostRoidSuffix")
154+
public static String provideHostRoidSuffix(RegistryConfigSettings config) {
155155
return config.registryPolicy.contactAndHostRoidSuffix;
156156
}
157157

@@ -1024,18 +1024,6 @@ public static Duration provideMetricsWriteInterval(RegistryConfigSettings config
10241024
return Duration.standardSeconds(config.monitoring.writeIntervalSeconds);
10251025
}
10261026

1027-
/**
1028-
* The global automatic transfer length for contacts. After this amount of time has elapsed, the
1029-
* transfer is automatically approved.
1030-
*
1031-
* @see google.registry.flows.contact.ContactTransferRequestFlow
1032-
*/
1033-
@Provides
1034-
@Config("contactAutomaticTransferLength")
1035-
public static Duration provideContactAutomaticTransferLength(RegistryConfigSettings config) {
1036-
return Duration.standardDays(config.registryPolicy.contactAutomaticTransferDays);
1037-
}
1038-
10391027
/**
10401028
* Returns the maximum number of entities that can be checked at one time in an EPP check flow.
10411029
*/
@@ -1623,15 +1611,11 @@ public static String getHibernateJdbcFetchSize() {
16231611
return CONFIG_SETTINGS.get().hibernate.jdbcFetchSize;
16241612
}
16251613

1626-
/** Returns the roid suffix to be used for the roids of all contacts and hosts. */
1627-
public static String getContactAndHostRoidSuffix() {
1614+
/** Returns the roid suffix to be used for the roids of all hosts. */
1615+
public static String getHostRoidSuffix() {
16281616
return CONFIG_SETTINGS.get().registryPolicy.contactAndHostRoidSuffix;
16291617
}
16301618

1631-
/** Returns the global automatic transfer length for contacts. */
1632-
public static Duration getContactAutomaticTransferLength() {
1633-
return Duration.standardDays(CONFIG_SETTINGS.get().registryPolicy.contactAutomaticTransferDays);
1634-
}
16351619

16361620
/** A discount for all sunrise domain creates, between 0.0 (no discount) and 1.0 (free). */
16371621
public static double getSunriseDomainCreateDiscount() {

core/src/main/java/google/registry/config/RegistryConfigSettings.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ public static class RegistryPolicy {
8686
public String productName;
8787
public String customLogicFactoryClass;
8888
public String dnsCountQueryCoordinatorClass;
89-
public int contactAutomaticTransferDays;
9089
public String greetingServerId;
9190
public List<String> registrarChangesNotificationEmailAddresses;
9291
public String defaultRegistrarWhoisServer;

core/src/main/java/google/registry/config/files/default-config.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ registryPolicy:
6363
# See reporting/icann/DnsCountQueryCoordinator.java
6464
dnsCountQueryCoordinatorClass: google.registry.reporting.icann.DummyDnsCountQueryCoordinator
6565

66-
# Length of time after which contact transfers automatically conclude.
67-
contactAutomaticTransferDays: 5
68-
6966
# Server ID used in the 'svID' element of an EPP 'greeting'.
7067
greetingServerId: Nomulus Registry
7168

core/src/main/java/google/registry/flows/host/HostCreateFlow.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public final class HostCreateFlow implements MutatingFlow {
8787
@Inject EppResponse.Builder responseBuilder;
8888

8989
@Inject
90-
@Config("contactAndHostRoidSuffix")
90+
@Config("hostRoidSuffix")
9191
String roidSuffix;
9292

9393
@Inject

core/src/main/java/google/registry/tools/CreateDomainCommand.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ protected void initMutatingEppToolCommand() {
8585
"domain", domain,
8686
"period", period,
8787
"nameservers", nameservers,
88-
"registrant", registrant,
89-
"admins", admins,
90-
"techs", techs,
9188
"password", password,
9289
"currency", currency,
9390
"price", cost,

core/src/main/java/google/registry/tools/CreateOrUpdateDomainCommand.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import com.google.common.base.Joiner;
2222
import com.google.common.collect.ImmutableSet;
2323
import google.registry.tools.params.NameserversParameter;
24-
import google.registry.tools.params.StringListParameter;
2524
import java.util.ArrayList;
2625
import java.util.HashSet;
2726
import java.util.List;
@@ -47,24 +46,6 @@ abstract class CreateOrUpdateDomainCommand extends MutatingEppToolCommand {
4746
validateWith = NameserversParameter.class)
4847
Set<String> nameservers = new HashSet<>();
4948

50-
@Parameter(
51-
names = {"-r", "--registrant"},
52-
description = "Domain registrant."
53-
)
54-
String registrant;
55-
56-
@Parameter(
57-
names = {"-a", "--admins"},
58-
description = "Comma-separated list of admin contacts.",
59-
listConverter = StringListParameter.class)
60-
List<String> admins = new ArrayList<>();
61-
62-
@Parameter(
63-
names = {"-t", "--techs"},
64-
description = "Comma-separated list of technical contacts.",
65-
listConverter = StringListParameter.class)
66-
List<String> techs = new ArrayList<>();
67-
6849
@Parameter(
6950
names = {"-p", "--password"},
7051
description = "Password."

core/src/main/java/google/registry/tools/UpdateDomainCommand.java

Lines changed: 2 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@
1515
package google.registry.tools;
1616

1717
import static com.google.common.base.Preconditions.checkArgument;
18-
import static com.google.common.collect.ImmutableSet.toImmutableSet;
1918
import static google.registry.model.domain.rgp.GracePeriodStatus.AUTO_RENEW;
2019
import static google.registry.model.eppcommon.StatusValue.PENDING_DELETE;
2120
import static google.registry.model.eppcommon.StatusValue.SERVER_UPDATE_PROHIBITED;
22-
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
2321
import static java.util.function.Predicate.isEqual;
2422

2523
import com.beust.jcommander.Parameter;
@@ -30,7 +28,6 @@
3028
import com.google.common.flogger.FluentLogger;
3129
import com.google.template.soy.data.SoyMapData;
3230
import google.registry.flows.ResourceFlowUtils;
33-
import google.registry.model.domain.DesignatedContact;
3431
import google.registry.model.domain.Domain;
3532
import google.registry.model.domain.GracePeriodBase;
3633
import google.registry.model.eppcommon.StatusValue;
@@ -66,15 +63,6 @@ final class UpdateDomainCommand extends CreateOrUpdateDomainCommand {
6663
validateWith = NameserversParameter.class)
6764
private Set<String> addNameservers = new HashSet<>();
6865

69-
// TODO(b/184067241): enforce only one of each type of contact
70-
@Parameter(
71-
names = "--add_admins",
72-
description = "Admins to add. Cannot be set if --admins is set.")
73-
private List<String> addAdmins = new ArrayList<>();
74-
75-
@Parameter(names = "--add_techs", description = "Techs to add. Cannot be set if --techs is set.")
76-
private List<String> addTechs = new ArrayList<>();
77-
7866
@Parameter(
7967
names = "--add_statuses",
8068
description = "Statuses to add. Cannot be set if --statuses is set."
@@ -97,18 +85,6 @@ final class UpdateDomainCommand extends CreateOrUpdateDomainCommand {
9785
validateWith = NameserversParameter.class)
9886
private Set<String> removeNameservers = new HashSet<>();
9987

100-
@Parameter(
101-
names = "--remove_admins",
102-
description = "Admins to remove. Cannot be set if --admins is set."
103-
)
104-
private List<String> removeAdmins = new ArrayList<>();
105-
106-
@Parameter(
107-
names = "--remove_techs",
108-
description = "Techs to remove. Cannot be set if --techs is set."
109-
)
110-
private List<String> removeTechs = new ArrayList<>();
111-
11288
@Parameter(
11389
names = "--remove_statuses",
11490
description = "Statuses to remove. Cannot be set if --statuses is set."
@@ -154,16 +130,6 @@ protected void initMutatingEppToolCommand()
154130
} else {
155131
checkArgument(addNameservers.size() <= 13, "You can add at most 13 nameservers.");
156132
}
157-
if (!admins.isEmpty()) {
158-
checkArgument(
159-
addAdmins.isEmpty() && removeAdmins.isEmpty(),
160-
"If you provide the admins flag, you cannot use the add_admins and remove_admins flags.");
161-
}
162-
if (!techs.isEmpty()) {
163-
checkArgument(
164-
addTechs.isEmpty() && removeTechs.isEmpty(),
165-
"If you provide the techs flag, you cannot use the add_techs and remove_techs flags.");
166-
}
167133
if (!statuses.isEmpty()) {
168134
checkArgument(
169135
addStatuses.isEmpty() && removeStatuses.isEmpty(),
@@ -197,16 +163,12 @@ protected void initMutatingEppToolCommand()
197163
domainName);
198164

199165
// Use TreeSets so that the results are always in the same order (this makes testing easier).
200-
Set<String> addAdminsThisDomain = new TreeSet<>(addAdmins);
201-
Set<String> removeAdminsThisDomain = new TreeSet<>(removeAdmins);
202-
Set<String> addTechsThisDomain = new TreeSet<>(addTechs);
203-
Set<String> removeTechsThisDomain = new TreeSet<>(removeTechs);
204166
Set<String> addNameserversThisDomain = new TreeSet<>(addNameservers);
205167
Set<String> removeNameserversThisDomain = new TreeSet<>(removeNameservers);
206168
Set<String> addStatusesThisDomain = new TreeSet<>(addStatuses);
207169
Set<String> removeStatusesThisDomain = new TreeSet<>(removeStatuses);
208170

209-
if (!nameservers.isEmpty() || !admins.isEmpty() || !techs.isEmpty() || !statuses.isEmpty()) {
171+
if (!nameservers.isEmpty() || !statuses.isEmpty()) {
210172
if (!nameservers.isEmpty()) {
211173
ImmutableSortedSet<String> existingNameservers = domain.loadNameserverHostNames();
212174
populateAddRemoveLists(
@@ -223,27 +185,7 @@ protected void initMutatingEppToolCommand()
223185
"The resulting nameservers count for domain %s would be more than 13",
224186
domainName);
225187
}
226-
if (!admins.isEmpty() || !techs.isEmpty()) {
227-
ImmutableSet<String> existingAdmins =
228-
getContactsOfType(domain, DesignatedContact.Type.ADMIN);
229-
ImmutableSet<String> existingTechs =
230-
getContactsOfType(domain, DesignatedContact.Type.TECH);
231188

232-
if (!admins.isEmpty()) {
233-
populateAddRemoveLists(
234-
ImmutableSet.copyOf(admins),
235-
existingAdmins,
236-
addAdminsThisDomain,
237-
removeAdminsThisDomain);
238-
}
239-
if (!techs.isEmpty()) {
240-
populateAddRemoveLists(
241-
ImmutableSet.copyOf(techs),
242-
existingTechs,
243-
addTechsThisDomain,
244-
removeTechsThisDomain);
245-
}
246-
}
247189
if (!statuses.isEmpty()) {
248190
Set<String> currentStatusValues = new HashSet<>();
249191
for (StatusValue statusValue : domain.getStatusValues()) {
@@ -259,17 +201,13 @@ protected void initMutatingEppToolCommand()
259201

260202
boolean add =
261203
(!addNameserversThisDomain.isEmpty()
262-
|| !addAdminsThisDomain.isEmpty()
263-
|| !addTechsThisDomain.isEmpty()
264204
|| !addStatusesThisDomain.isEmpty());
265205

266206
boolean remove =
267207
(!removeNameserversThisDomain.isEmpty()
268-
|| !removeAdminsThisDomain.isEmpty()
269-
|| !removeTechsThisDomain.isEmpty()
270208
|| !removeStatusesThisDomain.isEmpty());
271209

272-
boolean change = (registrant != null || password != null);
210+
boolean change = password != null;
273211
boolean secDns =
274212
(!addDsRecords.isEmpty()
275213
|| !removeDsRecords.isEmpty()
@@ -297,16 +235,11 @@ protected void initMutatingEppToolCommand()
297235
"domain", domainName,
298236
"add", add,
299237
"addNameservers", addNameserversThisDomain,
300-
"addAdmins", addAdminsThisDomain,
301-
"addTechs", addTechsThisDomain,
302238
"addStatuses", addStatusesThisDomain,
303239
"remove", remove,
304240
"removeNameservers", removeNameserversThisDomain,
305-
"removeAdmins", removeAdminsThisDomain,
306-
"removeTechs", removeTechsThisDomain,
307241
"removeStatuses", removeStatusesThisDomain,
308242
"change", change,
309-
"registrant", registrant,
310243
"password", password,
311244
"secdns", secDns,
312245
"addDsRecords", DsRecord.convertToSoy(addDsRecords),
@@ -337,13 +270,4 @@ private void populateAddRemoveLists(
337270
addSet.addAll(Sets.difference(targetSet, oldSet));
338271
removeSet.addAll(Sets.difference(oldSet, targetSet));
339272
}
340-
341-
ImmutableSet<String> getContactsOfType(Domain domain, final DesignatedContact.Type contactType) {
342-
return tm().transact(
343-
() ->
344-
domain.getContacts().stream()
345-
.filter(contact -> contact.getType().equals(contactType))
346-
.map(contact -> tm().loadByKey(contact.getContactKey()).getContactId())
347-
.collect(toImmutableSet()));
348-
}
349273
}

core/src/main/resources/google/registry/tools/soy/DomainUpdate.soy

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,11 @@
2020
{@param domain: string}
2121
{@param add: bool}
2222
{@param addNameservers: list<string>}
23-
{@param addAdmins: list<string>}
24-
{@param addTechs: list<string>}
2523
{@param addStatuses: list<string>}
2624
{@param remove: bool}
2725
{@param removeNameservers: list<string>}
28-
{@param removeAdmins: list<string>}
29-
{@param removeTechs: list<string>}
3026
{@param removeStatuses: list<string>}
3127
{@param change: bool}
32-
{@param? registrant: string|null}
3328
{@param? password: string|null}
3429
{@param secdns: bool}
3530
{@param addDsRecords: list<[keyTag:int, alg:int, digestType:int, digest:string]>}
@@ -54,12 +49,6 @@
5449
{/for}
5550
</domain:ns>
5651
{/if}
57-
{for $admin in $addAdmins}
58-
<domain:contact type="admin">{$admin}</domain:contact>
59-
{/for}
60-
{for $tech in $addTechs}
61-
<domain:contact type="tech">{$tech}</domain:contact>
62-
{/for}
6352
{for $status in $addStatuses}
6453
<domain:status s="{$status}"/>
6554
{/for}
@@ -74,22 +63,13 @@
7463
{/for}
7564
</domain:ns>
7665
{/if}
77-
{for $admin in $removeAdmins}
78-
<domain:contact type="admin">{$admin}</domain:contact>
79-
{/for}
80-
{for $tech in $removeTechs}
81-
<domain:contact type="tech">{$tech}</domain:contact>
82-
{/for}
8366
{for $status in $removeStatuses}
8467
<domain:status s="{$status}"/>
8568
{/for}
8669
</domain:rem>
8770
{/if}
8871
{if $change}
8972
<domain:chg>
90-
{if $registrant}
91-
<domain:registrant>{$registrant}</domain:registrant>
92-
{/if}
9373
{if $password}
9474
<domain:authInfo>
9575
<domain:pw>{$password}</domain:pw>

0 commit comments

Comments
 (0)