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 2a18e705a2
commit 4544aa1efe
6 changed files with 210 additions and 12 deletions

View file

@ -561,6 +561,16 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
.collect(toImmutableSortedSet(CONTACT_EMAIL_COMPARATOR));
}
/**
* Returns the {@link RegistrarContact} that is the WHOIS abuse contact for this registrar, or
* empty if one does not exist.
*/
public Optional<RegistrarContact> getWhoisAbuseContact() {
return getContacts().stream()
.filter(RegistrarContact::getVisibleInDomainWhoisAsAbuse)
.findFirst();
}
private Iterable<RegistrarContact> getContactsIterable() {
return ofy().load().type(RegistrarContact.class).ancestor(Registrar.this);
}