mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +02:00
Enforce abuse WHOIS contact for REAL registrars when adding TLDs
We do not enforce this for non-REAL registrars or in any environment other than UNITTEST or PRODUCTION. This is similar but separate to [] since we can add allowed TLDs in either location. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=239510275
This commit is contained in:
parent
9bf6a860bb
commit
7ff6667bdf
6 changed files with 210 additions and 12 deletions
|
@ -30,6 +30,7 @@ import com.beust.jcommander.Parameter;
|
|||
import com.beust.jcommander.Parameters;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Streams;
|
||||
import google.registry.config.RegistryEnvironment;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -86,14 +87,28 @@ final class CreateRegistrarCommand extends CreateOrUpdateRegistrarCommand
|
|||
.filter(registrar -> normalizeClientId(registrar.getClientId()).equals(clientId))
|
||||
.collect(toCollection(ArrayList::new));
|
||||
if (!collisions.isEmpty()) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"The registrar client identifier %s normalizes identically to existing registrar %s",
|
||||
clientId,
|
||||
collisions.get(0).getClientId()));
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The registrar client identifier %s normalizes identically to existing registrar %s",
|
||||
clientId, collisions.get(0).getClientId()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
void checkModifyAllowedTlds(@Nullable Registrar oldRegistrar) {
|
||||
// When creating a registrar, only allow allowed-TLD modification if we're in a non-PRODUCTION
|
||||
// environment and/or the registrar is not REAL
|
||||
checkArgument(
|
||||
!RegistryEnvironment.PRODUCTION.equals(RegistryEnvironment.get())
|
||||
|| !Registrar.Type.REAL.equals(registrarType),
|
||||
"Cannot add allowed TLDs when creating a REAL registrar in a production environment."
|
||||
+ " Please create the registrar without allowed TLDs, then use `nomulus"
|
||||
+ " registrar_contact` to create a registrar contact for it that is visible as the"
|
||||
+ " abuse contact in WHOIS. Then use `nomulus update_registrar` to add the allowed"
|
||||
+ " TLDs.");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String postExecute() {
|
||||
if (!createGoogleGroups) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue