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:
gbrodman 2019-03-20 17:30:46 -07:00 committed by jianglai
parent 9bf6a860bb
commit 7ff6667bdf
6 changed files with 210 additions and 12 deletions

View file

@ -258,6 +258,8 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand {
@Nullable
abstract Registrar getOldRegistrar(String clientId);
abstract void checkModifyAllowedTlds(@Nullable Registrar oldRegistrar);
protected void initRegistrarCommand() {}
@Override
@ -300,9 +302,12 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand {
if (driveFolderId != null) {
builder.setDriveFolderId(driveFolderId.orElse(null));
}
if (!allowedTlds.isEmpty() || !addAllowedTlds.isEmpty()) {
checkModifyAllowedTlds(oldRegistrar);
}
if (!allowedTlds.isEmpty()) {
checkArgument(addAllowedTlds.isEmpty(),
"Can't specify both --allowedTlds and --addAllowedTlds");
checkArgument(
addAllowedTlds.isEmpty(), "Can't specify both --allowedTlds and --addAllowedTlds");
ImmutableSet.Builder<String> allowedTldsBuilder = new ImmutableSet.Builder<>();
for (String allowedTld : allowedTlds) {
allowedTldsBuilder.add(canonicalizeDomainName(allowedTld));