mirror of
https://github.com/google/nomulus.git
synced 2025-08-01 23:42:12 +02:00
Remove Ofy from RegistrarContact (#1680)
Also renamed the class to RegistrarPoc and deleted some unused methods.
This commit is contained in:
parent
2c3279ba95
commit
63e4f4f10a
52 changed files with 551 additions and 700 deletions
|
@ -31,7 +31,7 @@ import google.registry.model.domain.DomainBase;
|
|||
import google.registry.model.domain.RegistryLock;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.model.tld.RegistryLockDao;
|
||||
import google.registry.persistence.VKey;
|
||||
import google.registry.request.Action;
|
||||
|
@ -296,8 +296,8 @@ public class RelockDomainAction implements Runnable {
|
|||
|
||||
ImmutableSet<String> registryLockEmailAddresses =
|
||||
registrar.getContacts().stream()
|
||||
.filter(RegistrarContact::isRegistryLockAllowed)
|
||||
.map(RegistrarContact::getRegistryLockEmailAddress)
|
||||
.filter(RegistrarPoc::isRegistryLockAllowed)
|
||||
.map(RegistrarPoc::getRegistryLockEmailAddress)
|
||||
.filter(Optional::isPresent)
|
||||
.map(Optional::get)
|
||||
.collect(toImmutableSet());
|
||||
|
|
|
@ -32,8 +32,8 @@ import com.google.common.net.MediaType;
|
|||
import google.registry.config.RegistryConfig.Config;
|
||||
import google.registry.flows.certs.CertificateChecker;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarContact.Type;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.model.registrar.RegistrarPoc.Type;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Response;
|
||||
import google.registry.request.auth.Auth;
|
||||
|
@ -281,9 +281,9 @@ public class SendExpiringCertificateNotificationEmailAction implements Runnable
|
|||
*/
|
||||
@VisibleForTesting
|
||||
ImmutableSet<InternetAddress> getEmailAddresses(Registrar registrar, Type contactType) {
|
||||
ImmutableSortedSet<RegistrarContact> contacts = registrar.getContactsOfType(contactType);
|
||||
ImmutableSortedSet<RegistrarPoc> contacts = registrar.getContactsOfType(contactType);
|
||||
ImmutableSet.Builder<InternetAddress> recipientEmails = new ImmutableSet.Builder<>();
|
||||
for (RegistrarContact contact : contacts) {
|
||||
for (RegistrarPoc contact : contacts) {
|
||||
try {
|
||||
recipientEmails.add(new InternetAddress(contact.getEmailAddress()));
|
||||
} catch (AddressException e) {
|
||||
|
|
|
@ -32,7 +32,7 @@ import google.registry.config.RegistryConfig.Config;
|
|||
import google.registry.groups.GroupsConnection;
|
||||
import google.registry.groups.GroupsConnection.Role;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Response;
|
||||
import google.registry.request.auth.Auth;
|
||||
|
@ -47,7 +47,7 @@ import javax.annotation.Nullable;
|
|||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* Action that syncs changes to {@link RegistrarContact} entities with Google Groups.
|
||||
* Action that syncs changes to {@link RegistrarPoc} entities with Google Groups.
|
||||
*
|
||||
* <p>This uses the <a href="https://developers.google.com/admin-sdk/directory/">Directory API</a>.
|
||||
*/
|
||||
|
@ -99,7 +99,7 @@ public final class SyncGroupMembersAction implements Runnable {
|
|||
* Returns the Google Groups email address for the given registrar ID and RegistrarContact.Type.
|
||||
*/
|
||||
public static String getGroupEmailAddressForContactType(
|
||||
String registrarId, RegistrarContact.Type type, String gSuiteDomainName) {
|
||||
String registrarId, RegistrarPoc.Type type, String gSuiteDomainName) {
|
||||
// Take the registrar's ID, make it lowercase, and remove all characters that aren't
|
||||
// alphanumeric, hyphens, or underscores.
|
||||
return String.format(
|
||||
|
@ -171,18 +171,17 @@ public final class SyncGroupMembersAction implements Runnable {
|
|||
private void syncRegistrarContacts(Registrar registrar) {
|
||||
String groupKey = "";
|
||||
try {
|
||||
Set<RegistrarContact> registrarContacts = registrar.getContacts();
|
||||
Set<RegistrarPoc> registrarPocs = registrar.getContacts();
|
||||
long totalAdded = 0;
|
||||
long totalRemoved = 0;
|
||||
for (final RegistrarContact.Type type : RegistrarContact.Type.values()) {
|
||||
for (final RegistrarPoc.Type type : RegistrarPoc.Type.values()) {
|
||||
groupKey =
|
||||
getGroupEmailAddressForContactType(registrar.getRegistrarId(), type, gSuiteDomainName);
|
||||
Set<String> currentMembers = groupsConnection.getMembersOfGroup(groupKey);
|
||||
Set<String> desiredMembers =
|
||||
registrarContacts
|
||||
.stream()
|
||||
registrarPocs.stream()
|
||||
.filter(contact -> contact.getTypes().contains(type))
|
||||
.map(RegistrarContact::getEmailAddress)
|
||||
.map(RegistrarPoc::getEmailAddress)
|
||||
.collect(toImmutableSet());
|
||||
for (String email : Sets.difference(desiredMembers, currentMembers)) {
|
||||
groupsConnection.addMemberToGroup(groupKey, email, Role.MEMBER);
|
||||
|
|
|
@ -17,13 +17,13 @@ package google.registry.export.sheet;
|
|||
import static com.google.common.base.MoreObjects.firstNonNull;
|
||||
import static com.google.common.collect.ImmutableList.toImmutableList;
|
||||
import static google.registry.model.common.Cursor.CursorType.SYNC_REGISTRAR_SHEET;
|
||||
import static google.registry.model.registrar.RegistrarContact.Type.ABUSE;
|
||||
import static google.registry.model.registrar.RegistrarContact.Type.ADMIN;
|
||||
import static google.registry.model.registrar.RegistrarContact.Type.BILLING;
|
||||
import static google.registry.model.registrar.RegistrarContact.Type.LEGAL;
|
||||
import static google.registry.model.registrar.RegistrarContact.Type.MARKETING;
|
||||
import static google.registry.model.registrar.RegistrarContact.Type.TECH;
|
||||
import static google.registry.model.registrar.RegistrarContact.Type.WHOIS;
|
||||
import static google.registry.model.registrar.RegistrarPoc.Type.ABUSE;
|
||||
import static google.registry.model.registrar.RegistrarPoc.Type.ADMIN;
|
||||
import static google.registry.model.registrar.RegistrarPoc.Type.BILLING;
|
||||
import static google.registry.model.registrar.RegistrarPoc.Type.LEGAL;
|
||||
import static google.registry.model.registrar.RegistrarPoc.Type.MARKETING;
|
||||
import static google.registry.model.registrar.RegistrarPoc.Type.TECH;
|
||||
import static google.registry.model.registrar.RegistrarPoc.Type.WHOIS;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.persistence.transaction.TransactionManagerUtil.transactIfJpaTm;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
|
@ -36,7 +36,7 @@ import com.google.common.collect.Ordering;
|
|||
import google.registry.model.common.Cursor;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarAddress;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.util.Clock;
|
||||
import google.registry.util.DateTimeUtils;
|
||||
import java.io.IOException;
|
||||
|
@ -92,7 +92,7 @@ class SyncRegistrarsSheet {
|
|||
.map(
|
||||
registrar -> {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<>();
|
||||
ImmutableSortedSet<RegistrarContact> contacts = registrar.getContacts();
|
||||
ImmutableSortedSet<RegistrarPoc> contacts = registrar.getContacts();
|
||||
RegistrarAddress address =
|
||||
firstNonNull(
|
||||
registrar.getLocalizedAddress(),
|
||||
|
@ -130,10 +130,10 @@ class SyncRegistrarsSheet {
|
|||
builder.put("billingContacts", convertContacts(contacts, byType(BILLING)));
|
||||
builder.put(
|
||||
"contactsMarkedAsWhoisAdmin",
|
||||
convertContacts(contacts, RegistrarContact::getVisibleInWhoisAsAdmin));
|
||||
convertContacts(contacts, RegistrarPoc::getVisibleInWhoisAsAdmin));
|
||||
builder.put(
|
||||
"contactsMarkedAsWhoisTech",
|
||||
convertContacts(contacts, RegistrarContact::getVisibleInWhoisAsTech));
|
||||
convertContacts(contacts, RegistrarPoc::getVisibleInWhoisAsTech));
|
||||
builder.put("emailAddress", convert(registrar.getEmailAddress()));
|
||||
builder.put("address.street", convert(address.getStreet()));
|
||||
builder.put("address.city", convert(address.getCity()));
|
||||
|
@ -158,10 +158,10 @@ class SyncRegistrarsSheet {
|
|||
}
|
||||
|
||||
private static String convertContacts(
|
||||
Iterable<RegistrarContact> contacts, Predicate<RegistrarContact> filter) {
|
||||
Iterable<RegistrarPoc> contacts, Predicate<RegistrarPoc> filter) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
boolean first = true;
|
||||
for (RegistrarContact contact : contacts) {
|
||||
for (RegistrarPoc contact : contacts) {
|
||||
if (!filter.test(contact)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ class SyncRegistrarsSheet {
|
|||
return result.toString();
|
||||
}
|
||||
|
||||
private static Predicate<RegistrarContact> byType(final RegistrarContact.Type type) {
|
||||
private static Predicate<RegistrarPoc> byType(final RegistrarPoc.Type type) {
|
||||
return contact -> contact.getTypes().contains(type);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ import google.registry.model.index.ForeignKeyIndex;
|
|||
import google.registry.model.poll.PollMessage;
|
||||
import google.registry.model.rde.RdeRevision;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.replay.LastSqlTransaction;
|
||||
import google.registry.model.replay.ReplayGap;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
|
@ -75,7 +74,6 @@ public final class EntityClasses {
|
|||
PollMessage.OneTime.class,
|
||||
RdeRevision.class,
|
||||
Registrar.class,
|
||||
RegistrarContact.class,
|
||||
Registry.class,
|
||||
ReplayGap.class,
|
||||
ServerSecret.class);
|
||||
|
|
|
@ -35,7 +35,7 @@ import google.registry.model.common.GaeUserIdConverter;
|
|||
import google.registry.model.pricing.StaticPremiumListPricingEngine;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarAddress;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Registry.TldState;
|
||||
import google.registry.model.tld.Registry.TldType;
|
||||
|
@ -127,8 +127,7 @@ public final class OteAccountBuilder {
|
|||
private final Registry sunriseTld;
|
||||
private final Registry gaTld;
|
||||
private final Registry eapTld;
|
||||
private final ImmutableList.Builder<RegistrarContact> contactsBuilder =
|
||||
new ImmutableList.Builder<>();
|
||||
private final ImmutableList.Builder<RegistrarPoc> contactsBuilder = new ImmutableList.Builder<>();
|
||||
|
||||
private ImmutableList<Registrar> registrars;
|
||||
private boolean replaceExisting = false;
|
||||
|
@ -259,7 +258,7 @@ public final class OteAccountBuilder {
|
|||
private void saveAllEntities() {
|
||||
// use ImmutableObject instead of Registry so that the Key generation doesn't break
|
||||
ImmutableList<Registry> registries = ImmutableList.of(sunriseTld, gaTld, eapTld);
|
||||
ImmutableList<RegistrarContact> contacts = contactsBuilder.build();
|
||||
ImmutableList<RegistrarPoc> contacts = contactsBuilder.build();
|
||||
|
||||
tm().transact(
|
||||
() -> {
|
||||
|
@ -269,7 +268,7 @@ public final class OteAccountBuilder {
|
|||
registries.stream()
|
||||
.map(registry -> Registry.createVKey(registry.getTldStr())),
|
||||
registrars.stream().map(Registrar::createVKey),
|
||||
contacts.stream().map(RegistrarContact::createVKey))
|
||||
contacts.stream().map(RegistrarPoc::createVKey))
|
||||
.collect(toImmutableList());
|
||||
ImmutableMap<VKey<? extends ImmutableObject>, ImmutableObject> existingObjects =
|
||||
tm().loadByKeysIfPresent(keys);
|
||||
|
@ -351,10 +350,10 @@ public final class OteAccountBuilder {
|
|||
.build();
|
||||
}
|
||||
|
||||
private static RegistrarContact createRegistrarContact(
|
||||
private static RegistrarPoc createRegistrarContact(
|
||||
String email, String gaeUserId, Registrar registrar) {
|
||||
return new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
return new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName(email)
|
||||
.setEmailAddress(email)
|
||||
.setGaeUserId(gaeUserId)
|
||||
|
|
|
@ -217,11 +217,9 @@ public class Registrar extends ImmutableObject
|
|||
immutableEnumSet(
|
||||
Type.REAL, Type.PDT, Type.OTE, Type.EXTERNAL_MONITORING, Type.MONITORING, Type.INTERNAL);
|
||||
|
||||
/**
|
||||
* Compare two instances of {@link RegistrarContact} by their email addresses lexicographically.
|
||||
*/
|
||||
private static final Comparator<RegistrarContact> CONTACT_EMAIL_COMPARATOR =
|
||||
comparing(RegistrarContact::getEmailAddress, String::compareTo);
|
||||
/** Compare two instances of {@link RegistrarPoc} by their email addresses lexicographically. */
|
||||
private static final Comparator<RegistrarPoc> CONTACT_EMAIL_COMPARATOR =
|
||||
comparing(RegistrarPoc::getEmailAddress, String::compareTo);
|
||||
|
||||
/**
|
||||
* A caching {@link Supplier} of a registrarId to {@link Registrar} map.
|
||||
|
@ -628,46 +626,43 @@ public class Registrar extends ImmutableObject
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all {@link RegistrarContact} objects for this registrar sorted by their email
|
||||
* Returns a list of all {@link RegistrarPoc} objects for this registrar sorted by their email
|
||||
* address.
|
||||
*/
|
||||
public ImmutableSortedSet<RegistrarContact> getContacts() {
|
||||
public ImmutableSortedSet<RegistrarPoc> getContacts() {
|
||||
return Streams.stream(getContactsIterable())
|
||||
.filter(Objects::nonNull)
|
||||
.collect(toImmutableSortedSet(CONTACT_EMAIL_COMPARATOR));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of {@link RegistrarContact} objects of a given type for this registrar sorted by
|
||||
* Returns a list of {@link RegistrarPoc} objects of a given type for this registrar sorted by
|
||||
* their email address.
|
||||
*/
|
||||
public ImmutableSortedSet<RegistrarContact> getContactsOfType(final RegistrarContact.Type type) {
|
||||
public ImmutableSortedSet<RegistrarPoc> getContactsOfType(final RegistrarPoc.Type type) {
|
||||
return Streams.stream(getContactsIterable())
|
||||
.filter(Objects::nonNull)
|
||||
.filter((@Nullable RegistrarContact contact) -> contact.getTypes().contains(type))
|
||||
.filter((@Nullable RegistrarPoc contact) -> contact.getTypes().contains(type))
|
||||
.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.
|
||||
* Returns the {@link RegistrarPoc} 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();
|
||||
public Optional<RegistrarPoc> getWhoisAbuseContact() {
|
||||
return getContacts().stream().filter(RegistrarPoc::getVisibleInDomainWhoisAsAbuse).findFirst();
|
||||
}
|
||||
|
||||
private Iterable<RegistrarContact> getContactsIterable() {
|
||||
private Iterable<RegistrarPoc> getContactsIterable() {
|
||||
if (tm().isOfy()) {
|
||||
return auditedOfy().load().type(RegistrarContact.class).ancestor(Registrar.this);
|
||||
return auditedOfy().load().type(RegistrarPoc.class).ancestor(Registrar.this);
|
||||
} else {
|
||||
return tm().transact(
|
||||
() ->
|
||||
jpaTm()
|
||||
.query(
|
||||
"FROM RegistrarPoc WHERE registrarId = :registrarId",
|
||||
RegistrarContact.class)
|
||||
"FROM RegistrarPoc WHERE registrarId = :registrarId", RegistrarPoc.class)
|
||||
.setParameter("registrarId", clientIdentifier)
|
||||
.getResultStream()
|
||||
.collect(toImmutableList()));
|
||||
|
|
|
@ -18,10 +18,7 @@ import static com.google.common.base.Preconditions.checkArgument;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Strings.isNullOrEmpty;
|
||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||
import static com.google.common.collect.Sets.difference;
|
||||
import static com.google.common.io.BaseEncoding.base64;
|
||||
import static google.registry.model.common.EntityGroupRoot.getCrossTldKey;
|
||||
import static google.registry.model.ofy.ObjectifyService.auditedOfy;
|
||||
import static google.registry.model.registrar.Registrar.checkValidEmail;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
|
@ -31,36 +28,26 @@ import static google.registry.util.PasswordUtils.hashPassword;
|
|||
import static java.util.stream.Collectors.joining;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Enums;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedSet;
|
||||
import com.google.common.collect.Streams;
|
||||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.annotation.Entity;
|
||||
import com.googlecode.objectify.annotation.Id;
|
||||
import com.googlecode.objectify.annotation.Ignore;
|
||||
import com.googlecode.objectify.annotation.Index;
|
||||
import com.googlecode.objectify.annotation.OnLoad;
|
||||
import com.googlecode.objectify.annotation.Parent;
|
||||
import google.registry.model.Buildable;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.JsonMapBuilder;
|
||||
import google.registry.model.Jsonifiable;
|
||||
import google.registry.model.UnsafeSerializable;
|
||||
import google.registry.model.annotations.InCrossTld;
|
||||
import google.registry.model.annotations.ReportedOn;
|
||||
import google.registry.model.registrar.RegistrarContact.RegistrarPocId;
|
||||
import google.registry.model.registrar.RegistrarPoc.RegistrarPocId;
|
||||
import google.registry.persistence.VKey;
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.IdClass;
|
||||
import javax.persistence.PostLoad;
|
||||
import javax.persistence.Index;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
/**
|
||||
* A contact for a Registrar. Note, equality, hashCode and comparable have been overridden to only
|
||||
|
@ -69,21 +56,12 @@ import javax.persistence.Transient;
|
|||
* <p>IMPORTANT NOTE: Any time that you change, update, or delete RegistrarContact entities, you
|
||||
* *MUST* also modify the persisted Registrar entity with {@link Registrar#contactsRequireSyncing}
|
||||
* set to true.
|
||||
*
|
||||
* <p>TODO(b/177567432): Rename the class name to RegistrarPoc after database migration
|
||||
*/
|
||||
@ReportedOn
|
||||
@Entity
|
||||
@javax.persistence.Entity(name = "RegistrarPoc")
|
||||
@Table(
|
||||
indexes = {
|
||||
@javax.persistence.Index(columnList = "gaeUserId", name = "registrarpoc_gae_user_id_idx")
|
||||
})
|
||||
@Table(indexes = {@Index(columnList = "gaeUserId", name = "registrarpoc_gae_user_id_idx")})
|
||||
@IdClass(RegistrarPocId.class)
|
||||
@InCrossTld
|
||||
public class RegistrarContact extends ImmutableObject implements Jsonifiable, UnsafeSerializable {
|
||||
|
||||
@Parent @Transient Key<Registrar> parent;
|
||||
public class RegistrarPoc extends ImmutableObject implements Jsonifiable, UnsafeSerializable {
|
||||
|
||||
/**
|
||||
* Registrar contacts types for partner communication tracking.
|
||||
|
@ -122,9 +100,9 @@ public class RegistrarContact extends ImmutableObject implements Jsonifiable, Un
|
|||
String name;
|
||||
|
||||
/** The email address of the contact. */
|
||||
@Id @javax.persistence.Id String emailAddress;
|
||||
@Id String emailAddress;
|
||||
|
||||
@Ignore @javax.persistence.Id String registrarId;
|
||||
@Id String registrarId;
|
||||
|
||||
/** External email address of this contact used for registry lock confirmations. */
|
||||
String registryLockEmailAddress;
|
||||
|
@ -148,7 +126,7 @@ public class RegistrarContact extends ImmutableObject implements Jsonifiable, Un
|
|||
*
|
||||
* @see com.google.appengine.api.users.User#getUserId()
|
||||
*/
|
||||
@Index String gaeUserId;
|
||||
String gaeUserId;
|
||||
|
||||
/**
|
||||
* Whether this contact is publicly visible in WHOIS registrar query results as an Admin contact.
|
||||
|
@ -168,7 +146,7 @@ public class RegistrarContact extends ImmutableObject implements Jsonifiable, Un
|
|||
boolean visibleInDomainWhoisAsAbuse = false;
|
||||
|
||||
/**
|
||||
* Whether or not the contact is allowed to set their registry lock password through the registrar
|
||||
* Whether the contact is allowed to set their registry lock password through the registrar
|
||||
* console. This will be set to false on contact creation and when the user sets a password.
|
||||
*/
|
||||
boolean allowedToSetRegistryLockPassword = false;
|
||||
|
@ -182,16 +160,6 @@ public class RegistrarContact extends ImmutableObject implements Jsonifiable, Un
|
|||
/** Randomly generated hash salt. */
|
||||
String registryLockPasswordSalt;
|
||||
|
||||
public static ImmutableSet<Type> typesFromCSV(String csv) {
|
||||
return typesFromStrings(Arrays.asList(csv.split(",")));
|
||||
}
|
||||
|
||||
public static ImmutableSet<Type> typesFromStrings(Iterable<String> typeNames) {
|
||||
return Streams.stream(typeNames)
|
||||
.map(Enums.stringConverter(Type.class))
|
||||
.collect(toImmutableSet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to update the contacts associated with a Registrar. This requires querying for the
|
||||
* existing contacts, deleting existing contacts that are not part of the given {@code contacts}
|
||||
|
@ -201,45 +169,23 @@ public class RegistrarContact extends ImmutableObject implements Jsonifiable, Un
|
|||
* relevant Registrar entity with the {@link Registrar#contactsRequireSyncing} field set to true.
|
||||
*/
|
||||
public static void updateContacts(
|
||||
final Registrar registrar, final ImmutableSet<RegistrarContact> contacts) {
|
||||
final Registrar registrar, final ImmutableSet<RegistrarPoc> contacts) {
|
||||
tm().transact(
|
||||
() -> {
|
||||
if (tm().isOfy()) {
|
||||
ImmutableSet<Key<RegistrarContact>> existingKeys =
|
||||
ImmutableSet.copyOf(
|
||||
auditedOfy()
|
||||
.load()
|
||||
.type(RegistrarContact.class)
|
||||
.ancestor(registrar)
|
||||
.keys());
|
||||
tm().delete(
|
||||
difference(
|
||||
existingKeys,
|
||||
contacts.stream().map(Key::create).collect(toImmutableSet()))
|
||||
.stream()
|
||||
.map(key -> VKey.createOfy(RegistrarContact.class, key))
|
||||
.collect(toImmutableSet()));
|
||||
} else {
|
||||
ImmutableSet<String> emailAddressesToKeep =
|
||||
contacts.stream()
|
||||
.map(RegistrarContact::getEmailAddress)
|
||||
.collect(toImmutableSet());
|
||||
jpaTm()
|
||||
.query(
|
||||
"DELETE FROM RegistrarPoc WHERE registrarId = :registrarId AND "
|
||||
+ "emailAddress NOT IN :emailAddressesToKeep")
|
||||
.setParameter("registrarId", registrar.getRegistrarId())
|
||||
.setParameter("emailAddressesToKeep", emailAddressesToKeep)
|
||||
.executeUpdate();
|
||||
}
|
||||
ImmutableSet<String> emailAddressesToKeep =
|
||||
contacts.stream().map(RegistrarPoc::getEmailAddress).collect(toImmutableSet());
|
||||
jpaTm()
|
||||
.query(
|
||||
"DELETE FROM RegistrarPoc WHERE registrarId = :registrarId AND "
|
||||
+ "emailAddress NOT IN :emailAddressesToKeep")
|
||||
.setParameter("registrarId", registrar.getRegistrarId())
|
||||
.setParameter("emailAddressesToKeep", emailAddressesToKeep)
|
||||
.executeUpdate();
|
||||
|
||||
tm().putAll(contacts);
|
||||
});
|
||||
}
|
||||
|
||||
public Key<Registrar> getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
@ -371,31 +317,11 @@ public class RegistrarContact extends ImmutableObject implements Jsonifiable, Un
|
|||
.build();
|
||||
}
|
||||
|
||||
/** Sets Cloud SQL specific fields when the entity is loaded from Datastore. */
|
||||
@OnLoad
|
||||
void onLoad() {
|
||||
registrarId = parent.getName();
|
||||
public VKey<RegistrarPoc> createVKey() {
|
||||
return VKey.createSql(RegistrarPoc.class, new RegistrarPocId(emailAddress, registrarId));
|
||||
}
|
||||
|
||||
/** Sets Datastore specific fields when the entity is loaded from Cloud SQL. */
|
||||
@PostLoad
|
||||
void postLoad() {
|
||||
parent = Key.create(getCrossTldKey(), Registrar.class, registrarId);
|
||||
}
|
||||
|
||||
public VKey<RegistrarContact> createVKey() {
|
||||
return createVKey(Key.create(this));
|
||||
}
|
||||
|
||||
/** Creates a {@link VKey} instance from a {@link Key} instance. */
|
||||
public static VKey<RegistrarContact> createVKey(Key<RegistrarContact> key) {
|
||||
Key<Registrar> parent = key.getParent();
|
||||
String registrarId = parent.getName();
|
||||
String emailAddress = key.getName();
|
||||
return VKey.create(RegistrarContact.class, new RegistrarPocId(emailAddress, registrarId), key);
|
||||
}
|
||||
|
||||
/** Class to represent the composite primary key for {@link RegistrarContact} entity. */
|
||||
/** Class to represent the composite primary key for {@link RegistrarPoc} entity. */
|
||||
@VisibleForTesting
|
||||
public static class RegistrarPocId extends ImmutableObject implements Serializable {
|
||||
|
||||
|
@ -404,6 +330,7 @@ public class RegistrarContact extends ImmutableObject implements Jsonifiable, Un
|
|||
String registrarId;
|
||||
|
||||
// Hibernate requires this default constructor.
|
||||
@SuppressWarnings("unused")
|
||||
private RegistrarPocId() {}
|
||||
|
||||
@VisibleForTesting
|
||||
|
@ -413,27 +340,18 @@ public class RegistrarContact extends ImmutableObject implements Jsonifiable, Un
|
|||
}
|
||||
}
|
||||
|
||||
/** A builder for constructing a {@link RegistrarContact}, since it is immutable. */
|
||||
public static class Builder extends Buildable.Builder<RegistrarContact> {
|
||||
/** A builder for constructing a {@link RegistrarPoc}, since it is immutable. */
|
||||
public static class Builder extends Buildable.Builder<RegistrarPoc> {
|
||||
public Builder() {}
|
||||
|
||||
private Builder(RegistrarContact instance) {
|
||||
private Builder(RegistrarPoc instance) {
|
||||
super(instance);
|
||||
}
|
||||
|
||||
public Builder setParent(Registrar parent) {
|
||||
return this.setParent(Key.create(parent));
|
||||
}
|
||||
|
||||
public Builder setParent(Key<Registrar> parentKey) {
|
||||
getInstance().parent = parentKey;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Build the registrar, nullifying empty fields. */
|
||||
@Override
|
||||
public RegistrarContact build() {
|
||||
checkNotNull(getInstance().parent, "Registrar parent cannot be null");
|
||||
public RegistrarPoc build() {
|
||||
checkNotNull(getInstance().registrarId, "Registrar ID cannot be null");
|
||||
checkValidEmail(getInstance().emailAddress);
|
||||
// Check allowedToSetRegistryLockPassword here because if we want to allow the user to set
|
||||
// a registry lock password, we must also set up the correct registry lock email concurrently
|
||||
|
@ -443,7 +361,6 @@ public class RegistrarContact extends ImmutableObject implements Jsonifiable, Un
|
|||
!isNullOrEmpty(getInstance().registryLockEmailAddress),
|
||||
"Registry lock email must not be null if allowing registry lock access");
|
||||
}
|
||||
getInstance().registrarId = getInstance().parent.getName();
|
||||
return cloneEmptyToNull(super.build());
|
||||
}
|
||||
|
||||
|
@ -467,6 +384,16 @@ public class RegistrarContact extends ImmutableObject implements Jsonifiable, Un
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder setRegistrarId(String registrarId) {
|
||||
getInstance().registrarId = registrarId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setRegistrar(Registrar registrar) {
|
||||
getInstance().registrarId = registrar.getRegistrarId();
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setFaxNumber(String faxNumber) {
|
||||
getInstance().faxNumber = faxNumber;
|
||||
return this;
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
package google.registry.persistence.converter;
|
||||
|
||||
import google.registry.model.registrar.RegistrarContact.Type;
|
||||
import google.registry.model.registrar.RegistrarPoc.Type;
|
||||
import javax.persistence.AttributeConverter;
|
||||
import javax.persistence.Converter;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ import google.registry.model.eppcommon.StatusValue;
|
|||
import google.registry.model.host.HostResource;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarAddress;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.reporting.HistoryEntryDao;
|
||||
import google.registry.persistence.VKey;
|
||||
|
@ -777,7 +777,7 @@ public class RdapJsonFormatter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a JSON object for a {@link RegistrarContact}.
|
||||
* Creates a JSON object for a {@link RegistrarPoc}.
|
||||
*
|
||||
* <p>Returns empty if this contact shouldn't be visible (doesn't have a role).
|
||||
*
|
||||
|
@ -794,11 +794,10 @@ public class RdapJsonFormatter {
|
|||
* <li>Registrar inside a Nameserver isn't required at all, and if given doesn't require any
|
||||
* contacts
|
||||
*
|
||||
* @param registrarContact the registrar contact for which the JSON object should be created
|
||||
* @param registrarPoc the registrar contact for which the JSON object should be created
|
||||
*/
|
||||
static Optional<RdapContactEntity> makeRdapJsonForRegistrarContact(
|
||||
RegistrarContact registrarContact) {
|
||||
ImmutableList<RdapEntity.Role> roles = makeRdapRoleList(registrarContact);
|
||||
static Optional<RdapContactEntity> makeRdapJsonForRegistrarContact(RegistrarPoc registrarPoc) {
|
||||
ImmutableList<RdapEntity.Role> roles = makeRdapRoleList(registrarPoc);
|
||||
if (roles.isEmpty()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
@ -808,20 +807,20 @@ public class RdapJsonFormatter {
|
|||
// Create the vCard.
|
||||
VcardArray.Builder vcardBuilder = VcardArray.builder();
|
||||
// MUST include FN member: RDAP Response Profile 3.2
|
||||
String name = registrarContact.getName();
|
||||
String name = registrarPoc.getName();
|
||||
if (name != null) {
|
||||
vcardBuilder.add(Vcard.create("fn", "text", name));
|
||||
}
|
||||
// MUST include TEL and EMAIL members: RDAP Response Profile 2.4.5, 3.2
|
||||
String voicePhoneNumber = registrarContact.getPhoneNumber();
|
||||
String voicePhoneNumber = registrarPoc.getPhoneNumber();
|
||||
if (voicePhoneNumber != null) {
|
||||
vcardBuilder.add(makePhoneEntry(PHONE_TYPE_VOICE, "tel:" + voicePhoneNumber));
|
||||
}
|
||||
String faxPhoneNumber = registrarContact.getFaxNumber();
|
||||
String faxPhoneNumber = registrarPoc.getFaxNumber();
|
||||
if (faxPhoneNumber != null) {
|
||||
vcardBuilder.add(makePhoneEntry(PHONE_TYPE_FAX, "tel:" + faxPhoneNumber));
|
||||
}
|
||||
String emailAddress = registrarContact.getEmailAddress();
|
||||
String emailAddress = registrarPoc.getEmailAddress();
|
||||
if (emailAddress != null) {
|
||||
vcardBuilder.add(Vcard.create("email", "text", emailAddress));
|
||||
}
|
||||
|
@ -857,16 +856,15 @@ public class RdapJsonFormatter {
|
|||
*
|
||||
* <p>3.2. For direct Registrar queries, we SHOULD have at least "admin" and "tech".
|
||||
*/
|
||||
private static ImmutableList<RdapEntity.Role> makeRdapRoleList(
|
||||
RegistrarContact registrarContact) {
|
||||
private static ImmutableList<RdapEntity.Role> makeRdapRoleList(RegistrarPoc registrarPoc) {
|
||||
ImmutableList.Builder<RdapEntity.Role> rolesBuilder = new ImmutableList.Builder<>();
|
||||
if (registrarContact.getVisibleInWhoisAsAdmin()) {
|
||||
if (registrarPoc.getVisibleInWhoisAsAdmin()) {
|
||||
rolesBuilder.add(RdapEntity.Role.ADMIN);
|
||||
}
|
||||
if (registrarContact.getVisibleInWhoisAsTech()) {
|
||||
if (registrarPoc.getVisibleInWhoisAsTech()) {
|
||||
rolesBuilder.add(RdapEntity.Role.TECH);
|
||||
}
|
||||
if (registrarContact.getVisibleInDomainWhoisAsAbuse()) {
|
||||
if (registrarPoc.getVisibleInDomainWhoisAsAbuse()) {
|
||||
rolesBuilder.add(RdapEntity.Role.ABUSE);
|
||||
}
|
||||
return rolesBuilder.build();
|
||||
|
|
|
@ -34,7 +34,7 @@ import google.registry.beam.spec11.ThreatMatch;
|
|||
import google.registry.config.RegistryConfig.Config;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.reporting.spec11.soy.Spec11EmailSoyInfo;
|
||||
import google.registry.util.EmailMessage;
|
||||
import google.registry.util.SendEmailService;
|
||||
|
@ -219,7 +219,7 @@ public class Spec11EmailUtils {
|
|||
return new InternetAddress(
|
||||
registrar
|
||||
.getWhoisAbuseContact()
|
||||
.map(RegistrarContact::getEmailAddress)
|
||||
.map(RegistrarPoc::getEmailAddress)
|
||||
.orElse(registrar.getEmailAddress()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,26 +16,21 @@ package google.registry.request.auth;
|
|||
|
||||
import static com.google.common.base.MoreObjects.toStringHelper;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.collect.ImmutableList.toImmutableList;
|
||||
import static com.google.common.collect.Streams.stream;
|
||||
import static google.registry.model.ofy.ObjectifyService.auditedOfy;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.persistence.transaction.TransactionManagerUtil.transactIfJpaTm;
|
||||
|
||||
import com.google.appengine.api.users.User;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSetMultimap;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.googlecode.objectify.Key;
|
||||
import dagger.Lazy;
|
||||
import google.registry.config.RegistryConfig.Config;
|
||||
import google.registry.groups.GroupsConnection;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.Registrar.State;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import java.util.Optional;
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
import javax.inject.Inject;
|
||||
|
@ -43,8 +38,8 @@ import javax.inject.Inject;
|
|||
/**
|
||||
* Allows access only to {@link Registrar}s the current user has access to.
|
||||
*
|
||||
* <p>A user has OWNER role on a Registrar if there exists a {@link RegistrarContact} with that
|
||||
* user's gaeId and the registrar as a parent.
|
||||
* <p>A user has OWNER role on a Registrar if there exists a {@link RegistrarPoc} with that user's
|
||||
* gaeId and the registrar as a parent.
|
||||
*
|
||||
* <p>An "admin" has in addition OWNER role on {@code #registryAdminClientId} and to all non-{@code
|
||||
* REAL} registrars (see {@link Registrar#getType}).
|
||||
|
@ -54,8 +49,8 @@ import javax.inject.Inject;
|
|||
* <p>A user is an "admin" if they are a GAE-admin, or if their email is in the "Support" G Suite
|
||||
* group.
|
||||
*
|
||||
* <p>NOTE: to check whether the user is in the "Support" G Suite group, we need a connection to
|
||||
* G Suite. This in turn requires we have valid JsonCredentials, which not all environments have set
|
||||
* <p>NOTE: to check whether the user is in the "Support" G Suite group, we need a connection to G
|
||||
* Suite. This in turn requires we have valid JsonCredentials, which not all environments have set
|
||||
* up. This connection will be created lazily (only if needed).
|
||||
*
|
||||
* <p>Specifically, we don't instantiate the connection if: (a) gSuiteSupportGroupEmailAddress isn't
|
||||
|
@ -319,34 +314,19 @@ public class AuthenticatedRegistrarAccessor {
|
|||
logger.atInfo().log("Checking registrar contacts for user ID %s.", user.getUserId());
|
||||
|
||||
// Find all registrars that have a registrar contact with this user's ID.
|
||||
if (tm().isOfy()) {
|
||||
ImmutableList<Key<Registrar>> accessibleClientIds =
|
||||
stream(
|
||||
auditedOfy()
|
||||
.load()
|
||||
.type(RegistrarContact.class)
|
||||
.filter("gaeUserId", user.getUserId()))
|
||||
.map(RegistrarContact::getParent)
|
||||
.collect(toImmutableList());
|
||||
// Filter out disabled registrars (note that pending registrars still allow console login).
|
||||
auditedOfy().load().keys(accessibleClientIds).values().stream()
|
||||
.filter(registrar -> registrar.getState() != State.DISABLED)
|
||||
.forEach(registrar -> builder.put(registrar.getRegistrarId(), Role.OWNER));
|
||||
} else {
|
||||
jpaTm()
|
||||
.transact(
|
||||
() ->
|
||||
jpaTm()
|
||||
.query(
|
||||
"SELECT r FROM Registrar r INNER JOIN RegistrarPoc rp ON "
|
||||
+ "r.clientIdentifier = rp.registrarId WHERE rp.gaeUserId = "
|
||||
+ ":gaeUserId AND r.state != :state",
|
||||
Registrar.class)
|
||||
.setParameter("gaeUserId", user.getUserId())
|
||||
.setParameter("state", State.DISABLED)
|
||||
.getResultStream()
|
||||
.forEach(registrar -> builder.put(registrar.getRegistrarId(), Role.OWNER)));
|
||||
}
|
||||
jpaTm()
|
||||
.transact(
|
||||
() ->
|
||||
jpaTm()
|
||||
.query(
|
||||
"SELECT r FROM Registrar r INNER JOIN RegistrarPoc rp ON "
|
||||
+ "r.clientIdentifier = rp.registrarId WHERE rp.gaeUserId = "
|
||||
+ ":gaeUserId AND r.state != :state",
|
||||
Registrar.class)
|
||||
.setParameter("gaeUserId", user.getUserId())
|
||||
.setParameter("state", State.DISABLED)
|
||||
.getResultStream()
|
||||
.forEach(registrar -> builder.put(registrar.getRegistrarId(), Role.OWNER)));
|
||||
|
||||
// Admins have ADMIN access to all registrars, and also OWNER access to the registry registrar
|
||||
// and all non-REAL or non-live registrars.
|
||||
|
|
|
@ -31,7 +31,7 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.model.common.GaeUserIdConverter;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.tools.params.OptionalPhoneNumberParameter;
|
||||
import google.registry.tools.params.PathParameter;
|
||||
import java.io.IOException;
|
||||
|
@ -51,7 +51,7 @@ import javax.annotation.Nullable;
|
|||
@Parameters(
|
||||
separators = " =",
|
||||
commandDescription = "Create/read/update/delete the various contact lists for a Registrar.")
|
||||
final class RegistrarContactCommand extends MutatingCommand {
|
||||
final class RegistrarPocCommand extends MutatingCommand {
|
||||
|
||||
@Parameter(
|
||||
description = "Client identifier of the registrar account.",
|
||||
|
@ -155,8 +155,7 @@ final class RegistrarContactCommand extends MutatingCommand {
|
|||
private static final ImmutableSet<Mode> MODES_REQUIRING_CONTACT_SYNC =
|
||||
ImmutableSet.of(Mode.CREATE, Mode.UPDATE, Mode.DELETE);
|
||||
|
||||
@Nullable
|
||||
private ImmutableSet<RegistrarContact.Type> contactTypes;
|
||||
@Nullable private ImmutableSet<RegistrarPoc.Type> contactTypes;
|
||||
|
||||
@Override
|
||||
protected void init() throws Exception {
|
||||
|
@ -179,17 +178,16 @@ final class RegistrarContactCommand extends MutatingCommand {
|
|||
contactTypes = ImmutableSet.of();
|
||||
} else {
|
||||
contactTypes =
|
||||
contactTypeNames
|
||||
.stream()
|
||||
.map(Enums.stringConverter(RegistrarContact.Type.class))
|
||||
contactTypeNames.stream()
|
||||
.map(Enums.stringConverter(RegistrarPoc.Type.class))
|
||||
.collect(toImmutableSet());
|
||||
}
|
||||
ImmutableSet<RegistrarContact> contacts = registrar.getContacts();
|
||||
Map<String, RegistrarContact> contactsMap = new LinkedHashMap<>();
|
||||
for (RegistrarContact rc : contacts) {
|
||||
ImmutableSet<RegistrarPoc> contacts = registrar.getContacts();
|
||||
Map<String, RegistrarPoc> contactsMap = new LinkedHashMap<>();
|
||||
for (RegistrarPoc rc : contacts) {
|
||||
contactsMap.put(rc.getEmailAddress(), rc);
|
||||
}
|
||||
RegistrarContact oldContact;
|
||||
RegistrarPoc oldContact;
|
||||
switch (mode) {
|
||||
case LIST:
|
||||
listContacts(contacts);
|
||||
|
@ -206,7 +204,7 @@ final class RegistrarContactCommand extends MutatingCommand {
|
|||
contactsMap.get(checkNotNull(email, "--email is required when --mode=UPDATE")),
|
||||
"No contact with the given email: %s",
|
||||
email);
|
||||
RegistrarContact newContact = updateContact(oldContact, registrar);
|
||||
RegistrarPoc newContact = updateContact(oldContact, registrar);
|
||||
checkArgument(
|
||||
!oldContact.getVisibleInDomainWhoisAsAbuse()
|
||||
|| newContact.getVisibleInDomainWhoisAsAbuse(),
|
||||
|
@ -236,19 +234,19 @@ final class RegistrarContactCommand extends MutatingCommand {
|
|||
}
|
||||
}
|
||||
|
||||
private void listContacts(Set<RegistrarContact> contacts) throws IOException {
|
||||
private void listContacts(Set<RegistrarPoc> contacts) throws IOException {
|
||||
List<String> result = new ArrayList<>();
|
||||
for (RegistrarContact c : contacts) {
|
||||
for (RegistrarPoc c : contacts) {
|
||||
result.add(c.toStringMultilinePlainText());
|
||||
}
|
||||
Files.write(output, Joiner.on('\n').join(result).getBytes(UTF_8));
|
||||
}
|
||||
|
||||
private RegistrarContact createContact(Registrar registrar) {
|
||||
private RegistrarPoc createContact(Registrar registrar) {
|
||||
checkArgument(!isNullOrEmpty(name), "--name is required when --mode=CREATE");
|
||||
checkArgument(!isNullOrEmpty(email), "--email is required when --mode=CREATE");
|
||||
RegistrarContact.Builder builder = new RegistrarContact.Builder();
|
||||
builder.setParent(registrar);
|
||||
RegistrarPoc.Builder builder = new RegistrarPoc.Builder();
|
||||
builder.setRegistrar(registrar);
|
||||
builder.setName(name);
|
||||
builder.setEmailAddress(email);
|
||||
if (!isNullOrEmpty(registryLockEmail)) {
|
||||
|
@ -282,11 +280,11 @@ final class RegistrarContactCommand extends MutatingCommand {
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
private RegistrarContact updateContact(RegistrarContact contact, Registrar registrar) {
|
||||
private RegistrarPoc updateContact(RegistrarPoc contact, Registrar registrar) {
|
||||
checkNotNull(registrar);
|
||||
checkArgument(!isNullOrEmpty(email), "--email is required when --mode=UPDATE");
|
||||
RegistrarContact.Builder builder =
|
||||
contact.asBuilder().setEmailAddress(email).setParent(registrar);
|
||||
RegistrarPoc.Builder builder =
|
||||
contact.asBuilder().setEmailAddress(email).setRegistrar(registrar);
|
||||
if (!isNullOrEmpty(name)) {
|
||||
builder.setName(name);
|
||||
}
|
||||
|
@ -327,12 +325,11 @@ final class RegistrarContactCommand extends MutatingCommand {
|
|||
}
|
||||
|
||||
private void unsetOtherWhoisAbuseFlags(
|
||||
ImmutableSet<RegistrarContact> contacts, @Nullable String emailAddressNotToChange) {
|
||||
for (RegistrarContact contact : contacts) {
|
||||
ImmutableSet<RegistrarPoc> contacts, @Nullable String emailAddressNotToChange) {
|
||||
for (RegistrarPoc contact : contacts) {
|
||||
if (!contact.getEmailAddress().equals(emailAddressNotToChange)
|
||||
&& contact.getVisibleInDomainWhoisAsAbuse()) {
|
||||
RegistrarContact newContact =
|
||||
contact.asBuilder().setVisibleInDomainWhoisAsAbuse(false).build();
|
||||
RegistrarPoc newContact = contact.asBuilder().setVisibleInDomainWhoisAsAbuse(false).build();
|
||||
stageEntityChange(contact, newContact);
|
||||
}
|
||||
}
|
|
@ -97,7 +97,7 @@ public final class RegistryTool {
|
|||
.put("login", LoginCommand.class)
|
||||
.put("logout", LogoutCommand.class)
|
||||
.put("pending_escrow", PendingEscrowCommand.class)
|
||||
.put("registrar_contact", RegistrarContactCommand.class)
|
||||
.put("registrar_poc", RegistrarPocCommand.class)
|
||||
.put("renew_domain", RenewDomainCommand.class)
|
||||
.put("resave_environment_entities", ResaveEnvironmentEntitiesCommand.class)
|
||||
.put("save_sql_credential", SaveSqlCredentialCommand.class)
|
||||
|
|
|
@ -23,14 +23,14 @@ import com.beust.jcommander.Parameters;
|
|||
import com.googlecode.objectify.Key;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.model.tld.Registry;
|
||||
|
||||
/**
|
||||
* Command to re-save all environment entities to ensure that they have valid commit logs.
|
||||
*
|
||||
* <p>The entities that are re-saved are those of type {@link Registry}, {@link Registrar}, and
|
||||
* {@link RegistrarContact}.
|
||||
* {@link RegistrarPoc}.
|
||||
*/
|
||||
@Parameters(commandDescription = "Re-save all environment entities.")
|
||||
@DeleteAfterMigration
|
||||
|
@ -42,7 +42,7 @@ final class ResaveEnvironmentEntitiesCommand implements CommandWithRemoteApi {
|
|||
public void run() {
|
||||
batchSave(Registry.class);
|
||||
batchSave(Registrar.class);
|
||||
batchSave(RegistrarContact.class);
|
||||
batchSave(RegistrarPoc.class);
|
||||
}
|
||||
|
||||
private static <T> void batchSave(Class<T> clazz) {
|
||||
|
|
|
@ -24,7 +24,7 @@ import google.registry.config.RegistryConfig.Config;
|
|||
import google.registry.groups.GroupsConnection;
|
||||
import google.registry.groups.GroupsConnection.Role;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.HttpException.BadRequestException;
|
||||
import google.registry.request.HttpException.InternalServerErrorException;
|
||||
|
@ -64,7 +64,7 @@ public class CreateGroupsAction implements Runnable {
|
|||
if (registrar == null) {
|
||||
return;
|
||||
}
|
||||
List<RegistrarContact.Type> types = asList(RegistrarContact.Type.values());
|
||||
List<RegistrarPoc.Type> types = asList(RegistrarPoc.Type.values());
|
||||
// Concurrently create the groups for each RegistrarContact.Type, collecting the results from
|
||||
// each call (which are either an Exception if it failed, or absent() if it succeeded).
|
||||
List<Optional<Exception>> results =
|
||||
|
|
|
@ -28,7 +28,7 @@ import com.google.common.net.InternetDomainName;
|
|||
import com.google.re2j.Pattern;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarAddress;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.ui.forms.FormException;
|
||||
import google.registry.ui.forms.FormField;
|
||||
import google.registry.ui.forms.FormFieldException;
|
||||
|
@ -217,10 +217,10 @@ public final class RegistrarFormFields {
|
|||
public static final FormField<String, String> CONTACT_REGISTRY_LOCK_PASSWORD_FIELD =
|
||||
FormFields.NAME.asBuilderNamed("registryLockPassword").build();
|
||||
|
||||
public static final FormField<String, Set<RegistrarContact.Type>> CONTACT_TYPES =
|
||||
public static final FormField<String, Set<RegistrarPoc.Type>> CONTACT_TYPES =
|
||||
FormField.named("types")
|
||||
.uppercased()
|
||||
.asEnum(RegistrarContact.Type.class)
|
||||
.asEnum(RegistrarPoc.Type.class)
|
||||
.asSet(Splitter.on(',').omitEmptyStrings().trimResults())
|
||||
.build();
|
||||
|
||||
|
@ -348,8 +348,8 @@ public final class RegistrarFormFields {
|
|||
}
|
||||
}
|
||||
|
||||
public static ImmutableList<RegistrarContact.Builder> getRegistrarContactBuilders(
|
||||
ImmutableSet<RegistrarContact> existingContacts, @Nullable Map<String, ?> args) {
|
||||
public static ImmutableList<RegistrarPoc.Builder> getRegistrarContactBuilders(
|
||||
ImmutableSet<RegistrarPoc> existingContacts, @Nullable Map<String, ?> args) {
|
||||
if (args == null) {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ public final class RegistrarFormFields {
|
|||
if (!contactsAsMaps.isPresent()) {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
ImmutableList.Builder<RegistrarContact.Builder> result = new ImmutableList.Builder<>();
|
||||
ImmutableList.Builder<RegistrarPoc.Builder> result = new ImmutableList.Builder<>();
|
||||
for (Map<String, ?> contactAsMap : contactsAsMaps.get()) {
|
||||
String emailAddress =
|
||||
CONTACT_EMAIL_ADDRESS_FIELD
|
||||
|
@ -365,20 +365,19 @@ public final class RegistrarFormFields {
|
|||
.orElseThrow(
|
||||
() -> new IllegalArgumentException("Contacts from UI must have email addresses"));
|
||||
// Start with a new builder if the contact didn't previously exist
|
||||
RegistrarContact.Builder contactBuilder =
|
||||
RegistrarPoc.Builder contactBuilder =
|
||||
existingContacts.stream()
|
||||
.filter(rc -> rc.getEmailAddress().equals(emailAddress))
|
||||
.findFirst()
|
||||
.map(RegistrarContact::asBuilder)
|
||||
.orElse(new RegistrarContact.Builder());
|
||||
.map(RegistrarPoc::asBuilder)
|
||||
.orElse(new RegistrarPoc.Builder());
|
||||
applyRegistrarContactArgs(contactBuilder, contactAsMap);
|
||||
result.add(contactBuilder);
|
||||
}
|
||||
return result.build();
|
||||
}
|
||||
|
||||
private static void applyRegistrarContactArgs(
|
||||
RegistrarContact.Builder builder, Map<String, ?> args) {
|
||||
private static void applyRegistrarContactArgs(RegistrarPoc.Builder builder, Map<String, ?> args) {
|
||||
builder.setName(CONTACT_NAME_FIELD.extractUntyped(args).orElse(null));
|
||||
builder.setEmailAddress(CONTACT_EMAIL_ADDRESS_FIELD.extractUntyped(args).orElse(null));
|
||||
builder.setRegistryLockEmailAddress(
|
||||
|
|
|
@ -32,7 +32,7 @@ import com.google.template.soy.tofu.SoyTofu;
|
|||
import google.registry.config.RegistryEnvironment;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarAddress;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Action.Method;
|
||||
import google.registry.request.Parameter;
|
||||
|
@ -227,9 +227,9 @@ public final class ConsoleRegistrarCreatorAction extends HtmlAction {
|
|||
.setZip(optionalZip.orElse(null))
|
||||
.build())
|
||||
.build();
|
||||
RegistrarContact contact =
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
RegistrarPoc contact =
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName(consoleUserEmail.get())
|
||||
.setEmailAddress(consoleUserEmail.get())
|
||||
.setGaeUserId(gaeUserId)
|
||||
|
|
|
@ -42,8 +42,8 @@ import google.registry.export.sheet.SyncRegistrarsSheetAction;
|
|||
import google.registry.flows.certs.CertificateChecker;
|
||||
import google.registry.flows.certs.CertificateChecker.InsecureCertificateException;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarContact.Type;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.model.registrar.RegistrarPoc.Type;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Action.Service;
|
||||
import google.registry.request.HttpException.BadRequestException;
|
||||
|
@ -116,7 +116,7 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA
|
|||
|
||||
@Inject RegistrarSettingsAction() {}
|
||||
|
||||
private static boolean hasPhone(RegistrarContact contact) {
|
||||
private static boolean hasPhone(RegistrarPoc contact) {
|
||||
return contact.getPhoneNumber() != null;
|
||||
}
|
||||
|
||||
|
@ -202,15 +202,15 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA
|
|||
|
||||
abstract Registrar updatedRegistrar();
|
||||
|
||||
abstract ImmutableSet<RegistrarContact> contacts();
|
||||
abstract ImmutableSet<RegistrarPoc> contacts();
|
||||
|
||||
abstract ImmutableSet<RegistrarContact> updatedContacts();
|
||||
abstract ImmutableSet<RegistrarPoc> updatedContacts();
|
||||
|
||||
static EmailInfo create(
|
||||
Registrar registrar,
|
||||
Registrar updatedRegistrar,
|
||||
ImmutableSet<RegistrarContact> contacts,
|
||||
ImmutableSet<RegistrarContact> updatedContacts) {
|
||||
ImmutableSet<RegistrarPoc> contacts,
|
||||
ImmutableSet<RegistrarPoc> updatedContacts) {
|
||||
return new AutoValue_RegistrarSettingsAction_EmailInfo(
|
||||
registrar, updatedRegistrar, contacts, updatedContacts);
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA
|
|||
|
||||
// Keep the current contacts so we can later check that no required contact was
|
||||
// removed, email the changes to the contacts
|
||||
ImmutableSet<RegistrarContact> contacts = registrar.getContacts();
|
||||
ImmutableSet<RegistrarPoc> contacts = registrar.getContacts();
|
||||
|
||||
Registrar updatedRegistrar = registrar;
|
||||
// Do OWNER only updates to the registrar from the request.
|
||||
|
@ -273,7 +273,7 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA
|
|||
updatedRegistrar = checkAndUpdateAdminControlledFields(updatedRegistrar, args);
|
||||
|
||||
// read the contacts from the request.
|
||||
ImmutableSet<RegistrarContact> updatedContacts = readContacts(registrar, contacts, args);
|
||||
ImmutableSet<RegistrarPoc> updatedContacts = readContacts(registrar, contacts, args);
|
||||
|
||||
// Save the updated contacts
|
||||
if (!updatedContacts.equals(contacts)) {
|
||||
|
@ -281,7 +281,7 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA
|
|||
throw new ForbiddenException("Only OWNERs can update the contacts");
|
||||
}
|
||||
checkContactRequirements(contacts, updatedContacts);
|
||||
RegistrarContact.updateContacts(updatedRegistrar, updatedContacts);
|
||||
RegistrarPoc.updateContacts(updatedRegistrar, updatedContacts);
|
||||
updatedRegistrar = updatedRegistrar.asBuilder().setContactsRequireSyncing(true).build();
|
||||
}
|
||||
|
||||
|
@ -293,10 +293,10 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA
|
|||
}
|
||||
|
||||
private Map<String, Object> expandRegistrarWithContacts(
|
||||
Iterable<RegistrarContact> contacts, Registrar registrar) {
|
||||
Iterable<RegistrarPoc> contacts, Registrar registrar) {
|
||||
ImmutableSet<Map<String, Object>> expandedContacts =
|
||||
Streams.stream(contacts)
|
||||
.map(RegistrarContact::toDiffableFieldMap)
|
||||
.map(RegistrarPoc::toDiffableFieldMap)
|
||||
// Note: per the javadoc, toDiffableFieldMap includes sensitive data but we don't want
|
||||
// to display it here
|
||||
.peek(
|
||||
|
@ -463,10 +463,10 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA
|
|||
}
|
||||
|
||||
/** Reads the contacts from the supplied args. */
|
||||
public static ImmutableSet<RegistrarContact> readContacts(
|
||||
Registrar registrar, ImmutableSet<RegistrarContact> existingContacts, Map<String, ?> args) {
|
||||
public static ImmutableSet<RegistrarPoc> readContacts(
|
||||
Registrar registrar, ImmutableSet<RegistrarPoc> existingContacts, Map<String, ?> args) {
|
||||
return RegistrarFormFields.getRegistrarContactBuilders(existingContacts, args).stream()
|
||||
.map(builder -> builder.setParent(registrar).build())
|
||||
.map(builder -> builder.setRegistrar(registrar).build())
|
||||
.collect(toImmutableSet());
|
||||
}
|
||||
|
||||
|
@ -476,11 +476,10 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA
|
|||
* @throws FormException if the checks fail.
|
||||
*/
|
||||
void checkContactRequirements(
|
||||
ImmutableSet<RegistrarContact> existingContacts,
|
||||
ImmutableSet<RegistrarContact> updatedContacts) {
|
||||
ImmutableSet<RegistrarPoc> existingContacts, ImmutableSet<RegistrarPoc> updatedContacts) {
|
||||
// Check that no two contacts use the same email address.
|
||||
Set<String> emails = new HashSet<>();
|
||||
for (RegistrarContact contact : updatedContacts) {
|
||||
for (RegistrarPoc contact : updatedContacts) {
|
||||
if (!emails.add(contact.getEmailAddress())) {
|
||||
throw new ContactRequirementException(
|
||||
String.format(
|
||||
|
@ -489,14 +488,14 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA
|
|||
}
|
||||
}
|
||||
// Check that required contacts don't go away, once they are set.
|
||||
Multimap<Type, RegistrarContact> oldContactsByType = HashMultimap.create();
|
||||
for (RegistrarContact contact : existingContacts) {
|
||||
Multimap<Type, RegistrarPoc> oldContactsByType = HashMultimap.create();
|
||||
for (RegistrarPoc contact : existingContacts) {
|
||||
for (Type t : contact.getTypes()) {
|
||||
oldContactsByType.put(t, contact);
|
||||
}
|
||||
}
|
||||
Multimap<Type, RegistrarContact> newContactsByType = HashMultimap.create();
|
||||
for (RegistrarContact contact : updatedContacts) {
|
||||
Multimap<Type, RegistrarPoc> newContactsByType = HashMultimap.create();
|
||||
for (RegistrarPoc contact : updatedContacts) {
|
||||
for (Type t : contact.getTypes()) {
|
||||
newContactsByType.put(t, contact);
|
||||
}
|
||||
|
@ -507,7 +506,7 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA
|
|||
}
|
||||
}
|
||||
ensurePhoneNumberNotRemovedForContactTypes(oldContactsByType, newContactsByType, Type.TECH);
|
||||
Optional<RegistrarContact> domainWhoisAbuseContact =
|
||||
Optional<RegistrarPoc> domainWhoisAbuseContact =
|
||||
getDomainWhoisVisibleAbuseContact(updatedContacts);
|
||||
// If the new set has a domain WHOIS abuse contact, it must have a phone number.
|
||||
if (domainWhoisAbuseContact.isPresent()
|
||||
|
@ -525,13 +524,12 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA
|
|||
}
|
||||
|
||||
private static void checkContactRegistryLockRequirements(
|
||||
ImmutableSet<RegistrarContact> existingContacts,
|
||||
ImmutableSet<RegistrarContact> updatedContacts) {
|
||||
ImmutableSet<RegistrarPoc> existingContacts, ImmutableSet<RegistrarPoc> updatedContacts) {
|
||||
// Any contact(s) with new passwords must be allowed to set them
|
||||
for (RegistrarContact updatedContact : updatedContacts) {
|
||||
for (RegistrarPoc updatedContact : updatedContacts) {
|
||||
if (updatedContact.isRegistryLockAllowed()
|
||||
|| updatedContact.isAllowedToSetRegistryLockPassword()) {
|
||||
RegistrarContact existingContact =
|
||||
RegistrarPoc existingContact =
|
||||
existingContacts.stream()
|
||||
.filter(
|
||||
contact -> contact.getEmailAddress().equals(updatedContact.getEmailAddress()))
|
||||
|
@ -564,10 +562,10 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA
|
|||
|
||||
// Any previously-existing contacts with registry lock enabled cannot be deleted
|
||||
existingContacts.stream()
|
||||
.filter(RegistrarContact::isRegistryLockAllowed)
|
||||
.filter(RegistrarPoc::isRegistryLockAllowed)
|
||||
.forEach(
|
||||
contact -> {
|
||||
Optional<RegistrarContact> updatedContactOptional =
|
||||
Optional<RegistrarPoc> updatedContactOptional =
|
||||
updatedContacts.stream()
|
||||
.filter(
|
||||
updatedContact ->
|
||||
|
@ -593,8 +591,8 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA
|
|||
* one before.
|
||||
*/
|
||||
private static void ensurePhoneNumberNotRemovedForContactTypes(
|
||||
Multimap<Type, RegistrarContact> oldContactsByType,
|
||||
Multimap<Type, RegistrarContact> newContactsByType,
|
||||
Multimap<Type, RegistrarPoc> oldContactsByType,
|
||||
Multimap<Type, RegistrarPoc> newContactsByType,
|
||||
Type... types) {
|
||||
for (Type type : types) {
|
||||
if (oldContactsByType.get(type).stream().anyMatch(RegistrarSettingsAction::hasPhone)
|
||||
|
@ -615,9 +613,9 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA
|
|||
* WHOIS record. Therefore it is possible to return inside the loop once one such contact is
|
||||
* found.
|
||||
*/
|
||||
private static Optional<RegistrarContact> getDomainWhoisVisibleAbuseContact(
|
||||
Set<RegistrarContact> contacts) {
|
||||
return contacts.stream().filter(RegistrarContact::getVisibleInDomainWhoisAsAbuse).findFirst();
|
||||
private static Optional<RegistrarPoc> getDomainWhoisVisibleAbuseContact(
|
||||
Set<RegistrarPoc> contacts) {
|
||||
return contacts.stream().filter(RegistrarPoc::getVisibleInDomainWhoisAsAbuse).findFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -626,7 +624,7 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA
|
|||
* contact addresses and enqueues a task to re-sync the registrar sheet.
|
||||
*/
|
||||
private void sendExternalUpdatesIfNecessary(EmailInfo emailInfo) {
|
||||
ImmutableSet<RegistrarContact> existingContacts = emailInfo.contacts();
|
||||
ImmutableSet<RegistrarPoc> existingContacts = emailInfo.contacts();
|
||||
if (!sendEmailUtils.hasRecipients() && existingContacts.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -663,7 +661,7 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA
|
|||
DiffUtils.prettyPrintDiffedMap(diffs, null)),
|
||||
existingContacts.stream()
|
||||
.filter(c -> c.getTypes().contains(Type.ADMIN))
|
||||
.map(RegistrarContact::getEmailAddress)
|
||||
.map(RegistrarPoc::getEmailAddress)
|
||||
.collect(toImmutableList()));
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import com.google.common.net.MediaType;
|
|||
import com.google.gson.Gson;
|
||||
import google.registry.model.domain.RegistryLock;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.model.tld.RegistryLockDao;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Action.Method;
|
||||
|
@ -118,17 +118,15 @@ public final class RegistryLockGetAction implements JsonGetAction {
|
|||
}
|
||||
}
|
||||
|
||||
static Optional<RegistrarContact> getContactMatchingLogin(User user, Registrar registrar) {
|
||||
ImmutableList<RegistrarContact> matchingContacts =
|
||||
static Optional<RegistrarPoc> getContactMatchingLogin(User user, Registrar registrar) {
|
||||
ImmutableList<RegistrarPoc> matchingContacts =
|
||||
registrar.getContacts().stream()
|
||||
.filter(contact -> contact.getGaeUserId() != null)
|
||||
.filter(contact -> Objects.equals(contact.getGaeUserId(), user.getUserId()))
|
||||
.collect(toImmutableList());
|
||||
if (matchingContacts.size() > 1) {
|
||||
ImmutableList<String> matchingEmails =
|
||||
matchingContacts.stream()
|
||||
.map(RegistrarContact::getEmailAddress)
|
||||
.collect(toImmutableList());
|
||||
matchingContacts.stream().map(RegistrarPoc::getEmailAddress).collect(toImmutableList());
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"User ID %s had multiple matching contacts with email addresses %s",
|
||||
|
@ -157,15 +155,15 @@ public final class RegistryLockGetAction implements JsonGetAction {
|
|||
Registrar registrar = getRegistrarAndVerifyLockAccess(registrarAccessor, registrarId, isAdmin);
|
||||
User user = authResult.userAuthInfo().get().user();
|
||||
|
||||
Optional<RegistrarContact> contactOptional = getContactMatchingLogin(user, registrar);
|
||||
Optional<RegistrarPoc> contactOptional = getContactMatchingLogin(user, registrar);
|
||||
boolean isRegistryLockAllowed =
|
||||
isAdmin || contactOptional.map(RegistrarContact::isRegistryLockAllowed).orElse(false);
|
||||
isAdmin || contactOptional.map(RegistrarPoc::isRegistryLockAllowed).orElse(false);
|
||||
// Use the contact's registry lock email if it's present, else use the login email (for admins)
|
||||
String relevantEmail =
|
||||
isAdmin
|
||||
? user.getEmail()
|
||||
// if the contact isn't present, we shouldn't display the email anyway so empty is fine
|
||||
: contactOptional.flatMap(RegistrarContact::getRegistryLockEmailAddress).orElse("");
|
||||
: contactOptional.flatMap(RegistrarPoc::getRegistryLockEmailAddress).orElse("");
|
||||
return ImmutableMap.of(
|
||||
LOCK_ENABLED_FOR_CONTACT_PARAM,
|
||||
isRegistryLockAllowed,
|
||||
|
|
|
@ -33,7 +33,7 @@ import google.registry.config.RegistryConfig.Config;
|
|||
import google.registry.flows.domain.DomainFlowUtils;
|
||||
import google.registry.model.domain.RegistryLock;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.Action.Method;
|
||||
import google.registry.request.HttpException.ForbiddenException;
|
||||
|
@ -192,7 +192,7 @@ public class RegistryLockPostAction implements Runnable, JsonActionRunner.JsonAc
|
|||
// registry lock enabled, and that the user provided a correct password
|
||||
Registrar registrar =
|
||||
getRegistrarAndVerifyLockAccess(registrarAccessor, postInput.registrarId, false);
|
||||
RegistrarContact registrarContact =
|
||||
RegistrarPoc registrarPoc =
|
||||
getContactMatchingLogin(user, registrar)
|
||||
.orElseThrow(
|
||||
() ->
|
||||
|
@ -200,16 +200,16 @@ public class RegistryLockPostAction implements Runnable, JsonActionRunner.JsonAc
|
|||
String.format(
|
||||
"Cannot match user %s to registrar contact", user.getUserId())));
|
||||
checkArgument(
|
||||
registrarContact.verifyRegistryLockPassword(postInput.password),
|
||||
registrarPoc.verifyRegistryLockPassword(postInput.password),
|
||||
"Incorrect registry lock password for contact");
|
||||
return registrarContact
|
||||
return registrarPoc
|
||||
.getRegistryLockEmailAddress()
|
||||
.orElseThrow(
|
||||
() ->
|
||||
new IllegalStateException(
|
||||
String.format(
|
||||
"Contact %s had no registry lock email address",
|
||||
registrarContact.getEmailAddress())));
|
||||
registrarPoc.getEmailAddress())));
|
||||
}
|
||||
|
||||
/** Value class that represents the expected input body from the UI request. */
|
||||
|
|
|
@ -32,7 +32,7 @@ import google.registry.model.domain.DomainBase;
|
|||
import google.registry.model.domain.GracePeriod;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.model.translators.EnumToAttributeAdapter.EppEnum;
|
||||
import google.registry.persistence.VKey;
|
||||
import java.util.Objects;
|
||||
|
@ -80,11 +80,9 @@ final class DomainWhoisResponse extends WhoisResponseImpl {
|
|||
"Could not load registrar %s",
|
||||
domain.getCurrentSponsorRegistrarId());
|
||||
Registrar registrar = registrarOptional.get();
|
||||
Optional<RegistrarContact> abuseContact =
|
||||
registrar
|
||||
.getContacts()
|
||||
.stream()
|
||||
.filter(RegistrarContact::getVisibleInDomainWhoisAsAbuse)
|
||||
Optional<RegistrarPoc> abuseContact =
|
||||
registrar.getContacts().stream()
|
||||
.filter(RegistrarPoc::getVisibleInDomainWhoisAsAbuse)
|
||||
.findFirst();
|
||||
return WhoisResponseResults.create(
|
||||
new DomainEmitter()
|
||||
|
@ -102,10 +100,10 @@ final class DomainWhoisResponse extends WhoisResponseImpl {
|
|||
// is an abuse contact, we can get an email address from it.
|
||||
.emitField(
|
||||
"Registrar Abuse Contact Email",
|
||||
abuseContact.map(RegistrarContact::getEmailAddress).orElse(""))
|
||||
abuseContact.map(RegistrarPoc::getEmailAddress).orElse(""))
|
||||
.emitField(
|
||||
"Registrar Abuse Contact Phone",
|
||||
abuseContact.map(RegistrarContact::getPhoneNumber).orElse(""))
|
||||
abuseContact.map(RegistrarPoc::getPhoneNumber).orElse(""))
|
||||
.emitStatusValues(domain.getStatusValues(), domain.getGracePeriods())
|
||||
.emitContact("Registrant", Optional.of(domain.getRegistrant()), preferUnicode)
|
||||
.emitContact("Admin", getContactReference(Type.ADMIN), preferUnicode)
|
||||
|
|
|
@ -17,7 +17,7 @@ package google.registry.whois;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
import org.joda.time.DateTime;
|
||||
|
@ -44,7 +44,7 @@ class RegistrarWhoisResponse extends WhoisResponseImpl {
|
|||
|
||||
@Override
|
||||
public WhoisResponseResults getResponse(boolean preferUnicode, String disclaimer) {
|
||||
Set<RegistrarContact> contacts = registrar.getContacts();
|
||||
Set<RegistrarPoc> contacts = registrar.getContacts();
|
||||
String plaintext =
|
||||
new RegistrarEmitter()
|
||||
.emitField("Registrar", registrar.getRegistrarName())
|
||||
|
@ -59,8 +59,8 @@ class RegistrarWhoisResponse extends WhoisResponseImpl {
|
|||
registrar.getPhoneNumber(), registrar.getFaxNumber(), registrar.getEmailAddress())
|
||||
.emitField("Registrar WHOIS Server", registrar.getWhoisServer())
|
||||
.emitField("Registrar URL", registrar.getUrl())
|
||||
.emitRegistrarContacts("Admin", contacts, AdminOrTech.ADMIN)
|
||||
.emitRegistrarContacts("Technical", contacts, AdminOrTech.TECH)
|
||||
.emitRegistrarPocs("Admin", contacts, AdminOrTech.ADMIN)
|
||||
.emitRegistrarPocs("Technical", contacts, AdminOrTech.TECH)
|
||||
.emitLastUpdated(getTimestamp())
|
||||
.emitFooter(disclaimer)
|
||||
.toString();
|
||||
|
@ -70,11 +70,9 @@ class RegistrarWhoisResponse extends WhoisResponseImpl {
|
|||
/** An emitter with logic for registrars. */
|
||||
static class RegistrarEmitter extends Emitter<RegistrarEmitter> {
|
||||
/** Emits the registrar contact of the given type. */
|
||||
RegistrarEmitter emitRegistrarContacts(
|
||||
String contactLabel,
|
||||
Iterable<RegistrarContact> contacts,
|
||||
AdminOrTech type) {
|
||||
for (RegistrarContact contact : contacts) {
|
||||
RegistrarEmitter emitRegistrarPocs(
|
||||
String contactLabel, Iterable<RegistrarPoc> contacts, AdminOrTech type) {
|
||||
for (RegistrarPoc contact : contacts) {
|
||||
if ((type == AdminOrTech.ADMIN && contact.getVisibleInWhoisAsAdmin())
|
||||
|| (type == AdminOrTech.TECH && contact.getVisibleInWhoisAsTech())) {
|
||||
emitField(contactLabel + " Contact", contact.getName())
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
<class>google.registry.model.poll.PollMessage$Autorenew</class>
|
||||
<class>google.registry.model.rde.RdeRevision</class>
|
||||
<class>google.registry.model.registrar.Registrar</class>
|
||||
<class>google.registry.model.registrar.RegistrarContact</class>
|
||||
<class>google.registry.model.registrar.RegistrarPoc</class>
|
||||
<class>google.registry.model.tld.label.PremiumList</class>
|
||||
<class>google.registry.model.tld.label.PremiumList$PremiumEntry</class>
|
||||
<class>google.registry.model.tld.label.ReservedList</class>
|
||||
|
|
|
@ -35,8 +35,8 @@ import google.registry.batch.SendExpiringCertificateNotificationEmailAction.Regi
|
|||
import google.registry.flows.certs.CertificateChecker;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarAddress;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarContact.Type;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.model.registrar.RegistrarPoc.Type;
|
||||
import google.registry.testing.AppEngineExtension;
|
||||
import google.registry.testing.DualDatabaseTest;
|
||||
import google.registry.testing.FakeClock;
|
||||
|
@ -220,15 +220,15 @@ class SendExpiringCertificateNotificationEmailActionTest {
|
|||
.asBuilder()
|
||||
.setFailoverClientCertificate(cert.get(), clock.nowUtc())
|
||||
.build());
|
||||
ImmutableList<RegistrarContact> contacts =
|
||||
ImmutableList<RegistrarPoc> contacts =
|
||||
ImmutableList.of(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Will Doe")
|
||||
.setEmailAddress("will@example-registrar.tld")
|
||||
.setPhoneNumber("+1.3105551213")
|
||||
.setFaxNumber("+1.3105551213")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.TECH))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.TECH))
|
||||
.setVisibleInWhoisAsAdmin(true)
|
||||
.setVisibleInWhoisAsTech(false)
|
||||
.build());
|
||||
|
@ -510,51 +510,51 @@ class SendExpiringCertificateNotificationEmailActionTest {
|
|||
@TestOfyAndSql
|
||||
void getEmailAddresses_success_returnsAListOfEmails() throws Exception {
|
||||
Registrar registrar = persistResource(makeRegistrar1());
|
||||
ImmutableList<RegistrarContact> contacts =
|
||||
ImmutableList<RegistrarPoc> contacts =
|
||||
ImmutableList.of(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("John Doe")
|
||||
.setEmailAddress("jd@example-registrar.tld")
|
||||
.setPhoneNumber("+1.3105551213")
|
||||
.setFaxNumber("+1.3105551213")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.TECH))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.TECH))
|
||||
.setVisibleInWhoisAsAdmin(true)
|
||||
.setVisibleInWhoisAsTech(false)
|
||||
.build(),
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("John Smith")
|
||||
.setEmailAddress("js@example-registrar.tld")
|
||||
.setPhoneNumber("+1.1111111111")
|
||||
.setFaxNumber("+1.1111111111")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.TECH))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.TECH))
|
||||
.build(),
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Will Doe")
|
||||
.setEmailAddress("will@example-registrar.tld")
|
||||
.setPhoneNumber("+1.3105551213")
|
||||
.setFaxNumber("+1.3105551213")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.TECH))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.TECH))
|
||||
.setVisibleInWhoisAsAdmin(true)
|
||||
.setVisibleInWhoisAsTech(false)
|
||||
.build(),
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Mike Doe")
|
||||
.setEmailAddress("mike@example-registrar.tld")
|
||||
.setPhoneNumber("+1.1111111111")
|
||||
.setFaxNumber("+1.1111111111")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.ADMIN))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.ADMIN))
|
||||
.build(),
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("John T")
|
||||
.setEmailAddress("john@example-registrar.tld")
|
||||
.setPhoneNumber("+1.3105551215")
|
||||
.setFaxNumber("+1.3105551216")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.ADMIN))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.ADMIN))
|
||||
.setVisibleInWhoisAsTech(true)
|
||||
.build());
|
||||
persistSimpleResources(contacts);
|
||||
|
@ -710,20 +710,20 @@ class SendExpiringCertificateNotificationEmailActionTest {
|
|||
}
|
||||
|
||||
/** Returns persisted sample contacts with a customized contact email type. */
|
||||
private ImmutableList<RegistrarContact> persistSampleContacts(
|
||||
Registrar registrar, RegistrarContact.Type emailType) {
|
||||
private ImmutableList<RegistrarPoc> persistSampleContacts(
|
||||
Registrar registrar, RegistrarPoc.Type emailType) {
|
||||
return persistSimpleResources(
|
||||
ImmutableList.of(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Will Doe")
|
||||
.setEmailAddress("will@example-registrar.tld")
|
||||
.setPhoneNumber("+1.0105551213")
|
||||
.setFaxNumber("+1.0105551213")
|
||||
.setTypes(ImmutableSet.of(emailType))
|
||||
.build(),
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Will Smith")
|
||||
.setEmailAddress("will@test-registrar.tld")
|
||||
.setPhoneNumber("+1.3105551213")
|
||||
|
|
|
@ -16,9 +16,9 @@ package google.registry.export;
|
|||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.export.SyncGroupMembersAction.getGroupEmailAddressForContactType;
|
||||
import static google.registry.model.registrar.RegistrarContact.Type.ADMIN;
|
||||
import static google.registry.model.registrar.RegistrarContact.Type.MARKETING;
|
||||
import static google.registry.model.registrar.RegistrarContact.Type.TECH;
|
||||
import static google.registry.model.registrar.RegistrarPoc.Type.ADMIN;
|
||||
import static google.registry.model.registrar.RegistrarPoc.Type.MARKETING;
|
||||
import static google.registry.model.registrar.RegistrarPoc.Type.TECH;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.testing.DatabaseHelper.loadRegistrar;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
|
@ -37,7 +37,7 @@ import com.google.common.collect.Iterables;
|
|||
import google.registry.groups.DirectoryGroupsConnection;
|
||||
import google.registry.groups.GroupsConnection.Role;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.request.Response;
|
||||
import google.registry.testing.AppEngineExtension;
|
||||
import google.registry.testing.DualDatabaseTest;
|
||||
|
@ -78,10 +78,9 @@ public class SyncGroupMembersActionTest {
|
|||
|
||||
@TestOfyAndSql
|
||||
void test_getGroupEmailAddressForContactType_convertsToLowercase() {
|
||||
assertThat(getGroupEmailAddressForContactType(
|
||||
"SomeRegistrar",
|
||||
RegistrarContact.Type.ADMIN,
|
||||
"domain-registry.example"))
|
||||
assertThat(
|
||||
getGroupEmailAddressForContactType(
|
||||
"SomeRegistrar", RegistrarPoc.Type.ADMIN, "domain-registry.example"))
|
||||
.isEqualTo("someregistrar-primary-contacts@domain-registry.example");
|
||||
}
|
||||
|
||||
|
@ -156,15 +155,15 @@ public class SyncGroupMembersActionTest {
|
|||
when(connection.getMembersOfGroup("theregistrar-primary-contacts@domain-registry.example"))
|
||||
.thenReturn(ImmutableSet.of());
|
||||
persistResource(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(loadRegistrar("NewRegistrar"))
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(loadRegistrar("NewRegistrar"))
|
||||
.setName("Binary Star")
|
||||
.setEmailAddress("binarystar@example.tld")
|
||||
.setTypes(ImmutableSet.of(ADMIN, MARKETING))
|
||||
.build());
|
||||
persistResource(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(loadRegistrar("TheRegistrar"))
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(loadRegistrar("TheRegistrar"))
|
||||
.setName("Hexadecimal")
|
||||
.setEmailAddress("hexadecimal@snow.fall")
|
||||
.setTypes(ImmutableSet.of(TECH))
|
||||
|
|
|
@ -38,7 +38,7 @@ import google.registry.model.common.Cursor;
|
|||
import google.registry.model.ofy.Ofy;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarAddress;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.testing.AppEngineExtension;
|
||||
import google.registry.testing.DatabaseHelper;
|
||||
import google.registry.testing.DualDatabaseTest;
|
||||
|
@ -85,7 +85,7 @@ public class SyncRegistrarsSheetTest {
|
|||
// We don't do this for ofy because ofy's loadAllOf() can't be called in a transaction but
|
||||
// _must_ be called in a transaction in JPA.
|
||||
if (!tm().isOfy()) {
|
||||
tm().transact(() -> tm().loadAllOf(RegistrarContact.class))
|
||||
tm().transact(() -> tm().loadAllOf(RegistrarPoc.class))
|
||||
.forEach(DatabaseHelper::deleteResource);
|
||||
}
|
||||
Registrar.loadAll().forEach(DatabaseHelper::deleteResource);
|
||||
|
@ -161,33 +161,34 @@ public class SyncRegistrarsSheetTest {
|
|||
.setUrl("http://www.example.org/aaa_registrar")
|
||||
.setBillingAccountMap(ImmutableMap.of(USD, "USD1234", JPY, "JPY7890"))
|
||||
.build();
|
||||
ImmutableList<RegistrarContact> contacts = ImmutableList.of(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
.setName("Jane Doe")
|
||||
.setEmailAddress("contact@example.com")
|
||||
.setPhoneNumber("+1.1234567890")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.ADMIN, RegistrarContact.Type.BILLING))
|
||||
.build(),
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
.setName("John Doe")
|
||||
.setEmailAddress("john.doe@example.tld")
|
||||
.setPhoneNumber("+1.1234567890")
|
||||
.setFaxNumber("+1.1234567891")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.ADMIN))
|
||||
// Purposely flip the internal/external admin/tech
|
||||
// distinction to make sure we're not relying on it. Sigh.
|
||||
.setVisibleInWhoisAsAdmin(false)
|
||||
.setVisibleInWhoisAsTech(true)
|
||||
.setGaeUserId("light")
|
||||
.build(),
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
.setName("Jane Smith")
|
||||
.setEmailAddress("pride@example.net")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.TECH))
|
||||
.build());
|
||||
ImmutableList<RegistrarPoc> contacts =
|
||||
ImmutableList.of(
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Jane Doe")
|
||||
.setEmailAddress("contact@example.com")
|
||||
.setPhoneNumber("+1.1234567890")
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.ADMIN, RegistrarPoc.Type.BILLING))
|
||||
.build(),
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("John Doe")
|
||||
.setEmailAddress("john.doe@example.tld")
|
||||
.setPhoneNumber("+1.1234567890")
|
||||
.setFaxNumber("+1.1234567891")
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.ADMIN))
|
||||
// Purposely flip the internal/external admin/tech
|
||||
// distinction to make sure we're not relying on it. Sigh.
|
||||
.setVisibleInWhoisAsAdmin(false)
|
||||
.setVisibleInWhoisAsTech(true)
|
||||
.setGaeUserId("light")
|
||||
.build(),
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Jane Smith")
|
||||
.setEmailAddress("pride@example.net")
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.TECH))
|
||||
.build());
|
||||
// Use registrar key for contacts' parent.
|
||||
DateTime registrarCreationTime = persistResource(registrar).getCreationTime();
|
||||
persistSimpleResources(contacts);
|
||||
|
|
|
@ -30,7 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
|||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Registry.TldState;
|
||||
import google.registry.testing.AppEngineExtension;
|
||||
|
@ -93,9 +93,8 @@ public final class OteAccountBuilderTest {
|
|||
|
||||
private void assertContactExists(String registrarId, String email) {
|
||||
Registrar registrar = Registrar.loadByRegistrarId(registrarId).get();
|
||||
assertThat(registrar.getContacts().stream().map(RegistrarContact::getEmailAddress))
|
||||
.contains(email);
|
||||
RegistrarContact contact =
|
||||
assertThat(registrar.getContacts().stream().map(RegistrarPoc::getEmailAddress)).contains(email);
|
||||
RegistrarPoc contact =
|
||||
registrar.getContacts().stream()
|
||||
.filter(c -> email.equals(c.getEmailAddress()))
|
||||
.findAny()
|
||||
|
|
|
@ -34,7 +34,6 @@ import google.registry.model.index.ForeignKeyIndex.ForeignKeyHostIndex;
|
|||
import google.registry.model.poll.PollMessage;
|
||||
import google.registry.model.rde.RdeRevision;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.replay.LastSqlTransaction;
|
||||
import google.registry.model.replay.ReplayGap;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
|
@ -70,7 +69,6 @@ public class ClassPathManagerTest {
|
|||
assertThat(ClassPathManager.getClass("ReplayGap")).isEqualTo(ReplayGap.class);
|
||||
assertThat(ClassPathManager.getClass("ContactResource")).isEqualTo(ContactResource.class);
|
||||
assertThat(ClassPathManager.getClass("Cancellation")).isEqualTo(Cancellation.class);
|
||||
assertThat(ClassPathManager.getClass("RegistrarContact")).isEqualTo(RegistrarContact.class);
|
||||
assertThat(ClassPathManager.getClass("LastSqlTransaction")).isEqualTo(LastSqlTransaction.class);
|
||||
assertThat(ClassPathManager.getClass("GaeUserIdConverter")).isEqualTo(GaeUserIdConverter.class);
|
||||
assertThat(ClassPathManager.getClass("EppResourceIndexBucket"))
|
||||
|
@ -130,7 +128,6 @@ public class ClassPathManagerTest {
|
|||
assertThat(ClassPathManager.getClassName(ReplayGap.class)).isEqualTo("ReplayGap");
|
||||
assertThat(ClassPathManager.getClassName(ContactResource.class)).isEqualTo("ContactResource");
|
||||
assertThat(ClassPathManager.getClassName(Cancellation.class)).isEqualTo("Cancellation");
|
||||
assertThat(ClassPathManager.getClassName(RegistrarContact.class)).isEqualTo("RegistrarContact");
|
||||
assertThat(ClassPathManager.getClassName(LastSqlTransaction.class))
|
||||
.isEqualTo("LastSqlTransaction");
|
||||
assertThat(ClassPathManager.getClassName(GaeUserIdConverter.class))
|
||||
|
|
|
@ -63,7 +63,7 @@ import org.junit.jupiter.api.BeforeEach;
|
|||
class RegistrarTest extends EntityTestCase {
|
||||
|
||||
private Registrar registrar;
|
||||
private RegistrarContact abuseAdminContact;
|
||||
private RegistrarPoc abuseAdminContact;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
|
@ -127,27 +127,26 @@ class RegistrarTest extends EntityTestCase {
|
|||
.build());
|
||||
persistResource(registrar);
|
||||
abuseAdminContact =
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("John Abused")
|
||||
.setEmailAddress("johnabuse@example.com")
|
||||
.setVisibleInWhoisAsAdmin(true)
|
||||
.setVisibleInWhoisAsTech(false)
|
||||
.setPhoneNumber("+1.2125551213")
|
||||
.setFaxNumber("+1.2125551213")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.ABUSE, RegistrarContact.Type.ADMIN))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.ABUSE, RegistrarPoc.Type.ADMIN))
|
||||
.build();
|
||||
persistSimpleResources(
|
||||
ImmutableList.of(
|
||||
abuseAdminContact,
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("John Doe")
|
||||
.setEmailAddress("johndoe@example.com")
|
||||
.setPhoneNumber("+1.2125551213")
|
||||
.setFaxNumber("+1.2125551213")
|
||||
.setTypes(
|
||||
ImmutableSet.of(RegistrarContact.Type.LEGAL, RegistrarContact.Type.MARKETING))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.LEGAL, RegistrarPoc.Type.MARKETING))
|
||||
.build()));
|
||||
}
|
||||
|
||||
|
@ -296,50 +295,50 @@ class RegistrarTest extends EntityTestCase {
|
|||
@TestOfyAndSql
|
||||
void testSuccess_emptyContactTypesAllowed() {
|
||||
persistSimpleResource(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("John Abussy")
|
||||
.setEmailAddress("johnabussy@example.com")
|
||||
.setPhoneNumber("+1.2125551213")
|
||||
.setFaxNumber("+1.2125551213")
|
||||
// No setTypes(...)
|
||||
.build());
|
||||
for (RegistrarContact rc : registrar.getContacts()) {
|
||||
for (RegistrarPoc rc : registrar.getContacts()) {
|
||||
rc.toJsonMap();
|
||||
}
|
||||
}
|
||||
|
||||
@TestOfyAndSql
|
||||
void testSuccess_getContactsByType() {
|
||||
RegistrarContact newTechContact =
|
||||
RegistrarPoc newTechContact =
|
||||
persistSimpleResource(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Jake Tech")
|
||||
.setEmailAddress("jaketech@example.com")
|
||||
.setVisibleInWhoisAsAdmin(true)
|
||||
.setVisibleInWhoisAsTech(true)
|
||||
.setPhoneNumber("+1.2125551213")
|
||||
.setFaxNumber("+1.2125551213")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.TECH))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.TECH))
|
||||
.build());
|
||||
RegistrarContact newTechAbuseContact =
|
||||
RegistrarPoc newTechAbuseContact =
|
||||
persistSimpleResource(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Jim Tech-Abuse")
|
||||
.setEmailAddress("jimtechAbuse@example.com")
|
||||
.setVisibleInWhoisAsAdmin(true)
|
||||
.setVisibleInWhoisAsTech(true)
|
||||
.setPhoneNumber("+1.2125551213")
|
||||
.setFaxNumber("+1.2125551213")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.TECH, RegistrarContact.Type.ABUSE))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.TECH, RegistrarPoc.Type.ABUSE))
|
||||
.build());
|
||||
ImmutableSortedSet<RegistrarContact> techContacts =
|
||||
registrar.getContactsOfType(RegistrarContact.Type.TECH);
|
||||
ImmutableSortedSet<RegistrarPoc> techContacts =
|
||||
registrar.getContactsOfType(RegistrarPoc.Type.TECH);
|
||||
assertThat(techContacts).containsExactly(newTechContact, newTechAbuseContact).inOrder();
|
||||
ImmutableSortedSet<RegistrarContact> abuseContacts =
|
||||
registrar.getContactsOfType(RegistrarContact.Type.ABUSE);
|
||||
ImmutableSortedSet<RegistrarPoc> abuseContacts =
|
||||
registrar.getContactsOfType(RegistrarPoc.Type.ABUSE);
|
||||
assertThat(abuseContacts).containsExactly(newTechAbuseContact, abuseAdminContact).inOrder();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import google.registry.model.billing.BillingEvent.OneTime;
|
|||
import google.registry.model.common.ClassPathManager;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.host.HostResource;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.testing.AppEngineExtension;
|
||||
import google.registry.testing.TestObject;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
@ -68,7 +68,7 @@ class VKeyTest {
|
|||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> VKey.create(RegistrarContact.class, "fake@example.com"));
|
||||
() -> VKey.create(RegistrarPoc.class, "fake@example.com"));
|
||||
assertThat(thrown).hasMessageThat().contains("BackupGroupRoot");
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import com.google.common.io.Resources;
|
|||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.Registrar.State;
|
||||
import google.registry.model.registrar.RegistrarAddress;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.persistence.HibernateSchemaExporter;
|
||||
import google.registry.persistence.NomulusPostgreSql;
|
||||
import google.registry.persistence.PersistenceModule;
|
||||
|
@ -388,15 +388,15 @@ abstract class JpaTransactionManagerExtension implements BeforeEachCallback, Aft
|
|||
* Public factory for first RegistrarContact to allow comparison against stored value in unit
|
||||
* tests.
|
||||
*/
|
||||
public static RegistrarContact makeRegistrarContact1() {
|
||||
return new RegistrarContact.Builder()
|
||||
.setParent(makeRegistrar1())
|
||||
public static RegistrarPoc makeRegistrarContact1() {
|
||||
return new RegistrarPoc.Builder()
|
||||
.setRegistrar(makeRegistrar1())
|
||||
.setName("Jane Doe")
|
||||
.setVisibleInWhoisAsAdmin(true)
|
||||
.setVisibleInWhoisAsTech(false)
|
||||
.setEmailAddress("janedoe@theregistrar.com")
|
||||
.setPhoneNumber("+1.1234567890")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.ADMIN))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.ADMIN))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -404,25 +404,25 @@ abstract class JpaTransactionManagerExtension implements BeforeEachCallback, Aft
|
|||
* Public factory for second RegistrarContact to allow comparison against stored value in unit
|
||||
* tests.
|
||||
*/
|
||||
public static RegistrarContact makeRegistrarContact2() {
|
||||
return new RegistrarContact.Builder()
|
||||
.setParent(makeRegistrar2())
|
||||
public static RegistrarPoc makeRegistrarContact2() {
|
||||
return new RegistrarPoc.Builder()
|
||||
.setRegistrar(makeRegistrar2())
|
||||
.setName("John Doe")
|
||||
.setEmailAddress("johndoe@theregistrar.com")
|
||||
.setPhoneNumber("+1.1234567890")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.ADMIN))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.ADMIN))
|
||||
.setGaeUserId(THE_REGISTRAR_GAE_USER_ID)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static RegistrarContact makeRegistrarContact3() {
|
||||
return new RegistrarContact.Builder()
|
||||
.setParent(makeRegistrar2())
|
||||
public static RegistrarPoc makeRegistrarContact3() {
|
||||
return new RegistrarPoc.Builder()
|
||||
.setRegistrar(makeRegistrar2())
|
||||
.setName("Marla Singer")
|
||||
.setEmailAddress("Marla.Singer@crr.com")
|
||||
.setRegistryLockEmailAddress("Marla.Singer.RegistryLock@crr.com")
|
||||
.setPhoneNumber("+1.2128675309")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.TECH))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.TECH))
|
||||
.setGaeUserId(MARLA_SINGER_GAE_USER_ID)
|
||||
.setAllowedToSetRegistryLockPassword(true)
|
||||
.setRegistryLockPassword("hi")
|
||||
|
|
|
@ -40,7 +40,7 @@ import google.registry.model.eppcommon.StatusValue;
|
|||
import google.registry.model.host.HostResource;
|
||||
import google.registry.model.ofy.Ofy;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.transfer.DomainTransferData;
|
||||
import google.registry.model.transfer.TransferStatus;
|
||||
|
@ -260,43 +260,43 @@ class RdapJsonFormatterTest {
|
|||
clock.nowUtc().minusMonths(3)));
|
||||
}
|
||||
|
||||
static ImmutableList<RegistrarContact> makeMoreRegistrarContacts(Registrar registrar) {
|
||||
static ImmutableList<RegistrarPoc> makeMoreRegistrarContacts(Registrar registrar) {
|
||||
return ImmutableList.of(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Baby Doe")
|
||||
.setEmailAddress("babydoe@example.com")
|
||||
.setPhoneNumber("+1.2125551217")
|
||||
.setFaxNumber("+1.2125551218")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.ADMIN))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.ADMIN))
|
||||
.setVisibleInWhoisAsAdmin(false)
|
||||
.setVisibleInWhoisAsTech(false)
|
||||
.build(),
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("John Doe")
|
||||
.setEmailAddress("johndoe@example.com")
|
||||
.setFaxNumber("+1.2125551213")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.ADMIN))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.ADMIN))
|
||||
.setVisibleInWhoisAsAdmin(false)
|
||||
.setVisibleInWhoisAsTech(true)
|
||||
.build(),
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Jane Doe")
|
||||
.setEmailAddress("janedoe@example.com")
|
||||
.setPhoneNumber("+1.2125551215")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.TECH, RegistrarContact.Type.ADMIN))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.TECH, RegistrarPoc.Type.ADMIN))
|
||||
.setVisibleInWhoisAsAdmin(true)
|
||||
.setVisibleInWhoisAsTech(false)
|
||||
.build(),
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Play Doe")
|
||||
.setEmailAddress("playdoe@example.com")
|
||||
.setPhoneNumber("+1.2125551217")
|
||||
.setFaxNumber("+1.2125551218")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.BILLING))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.BILLING))
|
||||
.setVisibleInWhoisAsAdmin(true)
|
||||
.setVisibleInWhoisAsTech(true)
|
||||
.build());
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.schema.registrar;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.registrar.RegistrarContact.Type.WHOIS;
|
||||
import static google.registry.model.registrar.RegistrarPoc.Type.WHOIS;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm;
|
||||
import static google.registry.testing.DatabaseHelper.insertInDb;
|
||||
import static google.registry.testing.DatabaseHelper.loadByEntity;
|
||||
|
@ -23,7 +23,7 @@ import static google.registry.testing.SqlHelper.saveRegistrar;
|
|||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationWithCoverageExtension;
|
||||
import google.registry.testing.DatastoreEntityExtension;
|
||||
|
@ -33,8 +33,8 @@ import org.junit.jupiter.api.Order;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
|
||||
/** Unit tests for persisting {@link RegistrarContact} entities. */
|
||||
class RegistrarContactTest {
|
||||
/** Unit tests for persisting {@link RegistrarPoc} entities. */
|
||||
class RegistrarPocTest {
|
||||
|
||||
@RegisterExtension
|
||||
@Order(value = 1)
|
||||
|
@ -46,14 +46,14 @@ class RegistrarContactTest {
|
|||
|
||||
private Registrar testRegistrar;
|
||||
|
||||
private RegistrarContact testRegistrarPoc;
|
||||
private RegistrarPoc testRegistrarPoc;
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() {
|
||||
testRegistrar = saveRegistrar("registrarId");
|
||||
testRegistrarPoc =
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(testRegistrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(testRegistrar)
|
||||
.setName("Judith Registrar")
|
||||
.setEmailAddress("judith.doe@example.com")
|
||||
.setRegistryLockEmailAddress("judith.doe@external.com")
|
||||
|
@ -75,7 +75,7 @@ class RegistrarContactTest {
|
|||
@Test
|
||||
void testSerializable_succeeds() {
|
||||
insertInDb(testRegistrarPoc);
|
||||
RegistrarContact persisted = jpaTm().transact(() -> jpaTm().loadByEntity(testRegistrarPoc));
|
||||
RegistrarPoc persisted = jpaTm().transact(() -> jpaTm().loadByEntity(testRegistrarPoc));
|
||||
assertThat(SerializeUtils.serializeDeserialize(persisted)).isEqualTo(persisted);
|
||||
}
|
||||
}
|
|
@ -49,7 +49,7 @@ import google.registry.model.ofy.ObjectifyService;
|
|||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.Registrar.State;
|
||||
import google.registry.model.registrar.RegistrarAddress;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationWithCoverageExtension;
|
||||
|
@ -326,15 +326,15 @@ public final class AppEngineExtension implements BeforeEachCallback, AfterEachCa
|
|||
* Public factory for first RegistrarContact to allow comparison against stored value in unit
|
||||
* tests.
|
||||
*/
|
||||
public static RegistrarContact makeRegistrarContact1() {
|
||||
return new RegistrarContact.Builder()
|
||||
.setParent(makeRegistrar1())
|
||||
public static RegistrarPoc makeRegistrarContact1() {
|
||||
return new RegistrarPoc.Builder()
|
||||
.setRegistrar(makeRegistrar1())
|
||||
.setName("Jane Doe")
|
||||
.setVisibleInWhoisAsAdmin(true)
|
||||
.setVisibleInWhoisAsTech(false)
|
||||
.setEmailAddress("janedoe@theregistrar.com")
|
||||
.setPhoneNumber("+1.1234567890")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.ADMIN))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.ADMIN))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -342,25 +342,25 @@ public final class AppEngineExtension implements BeforeEachCallback, AfterEachCa
|
|||
* Public factory for second RegistrarContact to allow comparison against stored value in unit
|
||||
* tests.
|
||||
*/
|
||||
public static RegistrarContact makeRegistrarContact2() {
|
||||
return new RegistrarContact.Builder()
|
||||
.setParent(makeRegistrar2())
|
||||
public static RegistrarPoc makeRegistrarContact2() {
|
||||
return new RegistrarPoc.Builder()
|
||||
.setRegistrar(makeRegistrar2())
|
||||
.setName("John Doe")
|
||||
.setEmailAddress("johndoe@theregistrar.com")
|
||||
.setPhoneNumber("+1.1234567890")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.ADMIN))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.ADMIN))
|
||||
.setGaeUserId(THE_REGISTRAR_GAE_USER_ID)
|
||||
.build();
|
||||
}
|
||||
|
||||
public static RegistrarContact makeRegistrarContact3() {
|
||||
return new RegistrarContact.Builder()
|
||||
.setParent(makeRegistrar2())
|
||||
public static RegistrarPoc makeRegistrarContact3() {
|
||||
return new RegistrarPoc.Builder()
|
||||
.setRegistrar(makeRegistrar2())
|
||||
.setName("Marla Singer")
|
||||
.setEmailAddress("Marla.Singer@crr.com")
|
||||
.setRegistryLockEmailAddress("Marla.Singer.RegistryLock@crr.com")
|
||||
.setPhoneNumber("+1.2128675309")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.TECH))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.TECH))
|
||||
.setGaeUserId(MARLA_SINGER_GAE_USER_ID)
|
||||
.setAllowedToSetRegistryLockPassword(true)
|
||||
.setRegistryLockPassword("hi")
|
||||
|
|
|
@ -37,7 +37,7 @@ import google.registry.model.eppcommon.Trid;
|
|||
import google.registry.model.host.HostResource;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarAddress;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.persistence.VKey;
|
||||
import google.registry.util.Idn;
|
||||
|
@ -89,34 +89,34 @@ public final class FullFieldsTestEntityHelper {
|
|||
.build();
|
||||
}
|
||||
|
||||
public static ImmutableList<RegistrarContact> makeRegistrarContacts(Registrar registrar) {
|
||||
public static ImmutableList<RegistrarPoc> makeRegistrarContacts(Registrar registrar) {
|
||||
return ImmutableList.of(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("John Doe")
|
||||
.setEmailAddress("johndoe@example.com")
|
||||
.setPhoneNumber("+1.2125551213")
|
||||
.setFaxNumber("+1.2125551213")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.ADMIN))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.ADMIN))
|
||||
// Purposely flip the internal/external admin/tech
|
||||
// distinction to make sure we're not relying on it. Sigh.
|
||||
.setVisibleInWhoisAsAdmin(false)
|
||||
.setVisibleInWhoisAsTech(true)
|
||||
.build(),
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Jane Doe")
|
||||
.setEmailAddress("janedoe@example.com")
|
||||
.setPhoneNumber("+1.2125551215")
|
||||
.setFaxNumber("+1.2125551216")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.TECH))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.TECH))
|
||||
// Purposely flip the internal/external admin/tech
|
||||
// distinction to make sure we're not relying on it. Sigh.
|
||||
.setVisibleInWhoisAsAdmin(true)
|
||||
.setVisibleInWhoisAsTech(false)
|
||||
.build(),
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Jake Doe")
|
||||
.setEmailAddress("jakedoe@example.com")
|
||||
.setPhoneNumber("+1.2125551216")
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
package google.registry.tools;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.registrar.RegistrarContact.Type.ABUSE;
|
||||
import static google.registry.model.registrar.RegistrarContact.Type.ADMIN;
|
||||
import static google.registry.model.registrar.RegistrarContact.Type.TECH;
|
||||
import static google.registry.model.registrar.RegistrarContact.Type.WHOIS;
|
||||
import static google.registry.model.registrar.RegistrarPoc.Type.ABUSE;
|
||||
import static google.registry.model.registrar.RegistrarPoc.Type.ADMIN;
|
||||
import static google.registry.model.registrar.RegistrarPoc.Type.TECH;
|
||||
import static google.registry.model.registrar.RegistrarPoc.Type.WHOIS;
|
||||
import static google.registry.testing.DatabaseHelper.loadRegistrar;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.testing.DatabaseHelper.persistSimpleResource;
|
||||
|
@ -30,14 +30,14 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/** Unit tests for {@link RegistrarContactCommand}. */
|
||||
class RegistrarContactCommandTest extends CommandTestCase<RegistrarContactCommand> {
|
||||
/** Unit tests for {@link RegistrarPocCommand}. */
|
||||
class RegistrarPocCommandTest extends CommandTestCase<RegistrarPocCommand> {
|
||||
|
||||
private String output;
|
||||
|
||||
|
@ -49,11 +49,11 @@ class RegistrarContactCommandTest extends CommandTestCase<RegistrarContactComman
|
|||
@Test
|
||||
void testList() throws Exception {
|
||||
Registrar registrar = loadRegistrar("NewRegistrar");
|
||||
RegistrarContact.updateContacts(
|
||||
RegistrarPoc.updateContacts(
|
||||
registrar,
|
||||
ImmutableSet.of(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("John Doe")
|
||||
.setEmailAddress("john.doe@example.com")
|
||||
.setTypes(ImmutableSet.of(ADMIN))
|
||||
|
@ -75,16 +75,17 @@ class RegistrarContactCommandTest extends CommandTestCase<RegistrarContactComman
|
|||
@Test
|
||||
void testUpdate() throws Exception {
|
||||
Registrar registrar = loadRegistrar("NewRegistrar");
|
||||
ImmutableList<RegistrarContact> contacts = ImmutableList.of(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
.setName("Judith Doe")
|
||||
.setEmailAddress("judith.doe@example.com")
|
||||
.setTypes(ImmutableSet.of(WHOIS))
|
||||
.setVisibleInWhoisAsAdmin(true)
|
||||
.setVisibleInWhoisAsTech(true)
|
||||
.setVisibleInDomainWhoisAsAbuse(false)
|
||||
.build());
|
||||
ImmutableList<RegistrarPoc> contacts =
|
||||
ImmutableList.of(
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Judith Doe")
|
||||
.setEmailAddress("judith.doe@example.com")
|
||||
.setTypes(ImmutableSet.of(WHOIS))
|
||||
.setVisibleInWhoisAsAdmin(true)
|
||||
.setVisibleInWhoisAsTech(true)
|
||||
.setVisibleInDomainWhoisAsAbuse(false)
|
||||
.build());
|
||||
persistSimpleResources(contacts);
|
||||
runCommandForced(
|
||||
"--mode=UPDATE",
|
||||
|
@ -98,11 +99,11 @@ class RegistrarContactCommandTest extends CommandTestCase<RegistrarContactComman
|
|||
"--visible_in_whois_as_tech=false",
|
||||
"--visible_in_domain_whois_as_abuse=false",
|
||||
"NewRegistrar");
|
||||
RegistrarContact registrarContact = loadRegistrar("NewRegistrar").getContacts().asList().get(1);
|
||||
assertThat(registrarContact)
|
||||
RegistrarPoc registrarPoc = loadRegistrar("NewRegistrar").getContacts().asList().get(1);
|
||||
assertThat(registrarPoc)
|
||||
.isEqualTo(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Judith Registrar")
|
||||
.setEmailAddress("judith.doe@example.com")
|
||||
.setRegistryLockEmailAddress("judith.doe@external.com")
|
||||
|
@ -119,8 +120,8 @@ class RegistrarContactCommandTest extends CommandTestCase<RegistrarContactComman
|
|||
void testUpdate_enableConsoleAccess() throws Exception {
|
||||
Registrar registrar = loadRegistrar("NewRegistrar");
|
||||
persistSimpleResource(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Jane Doe")
|
||||
.setEmailAddress("jane.doe@example.com")
|
||||
.build());
|
||||
|
@ -129,20 +130,20 @@ class RegistrarContactCommandTest extends CommandTestCase<RegistrarContactComman
|
|||
"--email=jane.doe@example.com",
|
||||
"--allow_console_access=true",
|
||||
"NewRegistrar");
|
||||
RegistrarContact registrarContact =
|
||||
RegistrarPoc registrarPoc =
|
||||
loadRegistrar("NewRegistrar").getContacts().stream()
|
||||
.filter(rc -> rc.getEmailAddress().equals("jane.doe@example.com"))
|
||||
.findFirst()
|
||||
.get();
|
||||
assertThat(registrarContact.getGaeUserId()).matches("-?[0-9]+");
|
||||
assertThat(registrarPoc.getGaeUserId()).matches("-?[0-9]+");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testUpdate_disableConsoleAccess() throws Exception {
|
||||
Registrar registrar = loadRegistrar("NewRegistrar");
|
||||
persistSimpleResource(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Judith Doe")
|
||||
.setEmailAddress("judith.doe@example.com")
|
||||
.setGaeUserId("11111")
|
||||
|
@ -152,23 +153,23 @@ class RegistrarContactCommandTest extends CommandTestCase<RegistrarContactComman
|
|||
"--email=judith.doe@example.com",
|
||||
"--allow_console_access=false",
|
||||
"NewRegistrar");
|
||||
RegistrarContact registrarContact = loadRegistrar("NewRegistrar").getContacts().asList().get(1);
|
||||
assertThat(registrarContact.getGaeUserId()).isNull();
|
||||
RegistrarPoc registrarPoc = loadRegistrar("NewRegistrar").getContacts().asList().get(1);
|
||||
assertThat(registrarPoc.getGaeUserId()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testUpdate_unsetOtherWhoisAbuseFlags() throws Exception {
|
||||
Registrar registrar = loadRegistrar("NewRegistrar");
|
||||
persistSimpleResource(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("John Doe")
|
||||
.setEmailAddress("john.doe@example.com")
|
||||
.setGaeUserId("11111")
|
||||
.build());
|
||||
persistSimpleResource(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Johnna Doe")
|
||||
.setEmailAddress("johnna.doe@example.com")
|
||||
.setGaeUserId("11112")
|
||||
|
@ -179,13 +180,13 @@ class RegistrarContactCommandTest extends CommandTestCase<RegistrarContactComman
|
|||
"--email=john.doe@example.com",
|
||||
"--visible_in_domain_whois_as_abuse=true",
|
||||
"NewRegistrar");
|
||||
ImmutableList<RegistrarContact> registrarContacts =
|
||||
ImmutableList<RegistrarPoc> registrarPocs =
|
||||
loadRegistrar("NewRegistrar").getContacts().asList();
|
||||
for (RegistrarContact registrarContact : registrarContacts) {
|
||||
if (registrarContact.getName().equals("John Doe")) {
|
||||
assertThat(registrarContact.getVisibleInDomainWhoisAsAbuse()).isTrue();
|
||||
for (RegistrarPoc registrarPoc : registrarPocs) {
|
||||
if (registrarPoc.getName().equals("John Doe")) {
|
||||
assertThat(registrarPoc.getVisibleInDomainWhoisAsAbuse()).isTrue();
|
||||
} else {
|
||||
assertThat(registrarContact.getVisibleInDomainWhoisAsAbuse()).isFalse();
|
||||
assertThat(registrarPoc.getVisibleInDomainWhoisAsAbuse()).isFalse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -194,8 +195,8 @@ class RegistrarContactCommandTest extends CommandTestCase<RegistrarContactComman
|
|||
void testUpdate_cannotUnsetOnlyWhoisAbuseContact() {
|
||||
Registrar registrar = loadRegistrar("NewRegistrar");
|
||||
persistSimpleResource(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("John Doe")
|
||||
.setEmailAddress("john.doe@example.com")
|
||||
.setGaeUserId("11111")
|
||||
|
@ -213,39 +214,40 @@ class RegistrarContactCommandTest extends CommandTestCase<RegistrarContactComman
|
|||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains("Cannot clear visible_in_domain_whois_as_abuse flag");
|
||||
RegistrarContact registrarContact = loadRegistrar("NewRegistrar").getContacts().asList().get(1);
|
||||
assertThat(registrarContact.getVisibleInDomainWhoisAsAbuse()).isTrue();
|
||||
RegistrarPoc registrarPoc = loadRegistrar("NewRegistrar").getContacts().asList().get(1);
|
||||
assertThat(registrarPoc.getVisibleInDomainWhoisAsAbuse()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testUpdate_emptyCommandModifiesNothing() throws Exception {
|
||||
Registrar registrar = loadRegistrar("NewRegistrar");
|
||||
RegistrarContact existingContact = persistSimpleResource(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
.setName("John Doe")
|
||||
.setEmailAddress("john.doe@example.com")
|
||||
.setGaeUserId("11111")
|
||||
.setPhoneNumber("123-456-7890")
|
||||
.setFaxNumber("123-456-7890")
|
||||
.setTypes(ImmutableSet.of(ADMIN, ABUSE))
|
||||
.setVisibleInWhoisAsAdmin(true)
|
||||
.setVisibleInWhoisAsTech(true)
|
||||
.setVisibleInDomainWhoisAsAbuse(true)
|
||||
.build());
|
||||
RegistrarPoc existingContact =
|
||||
persistSimpleResource(
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("John Doe")
|
||||
.setEmailAddress("john.doe@example.com")
|
||||
.setGaeUserId("11111")
|
||||
.setPhoneNumber("123-456-7890")
|
||||
.setFaxNumber("123-456-7890")
|
||||
.setTypes(ImmutableSet.of(ADMIN, ABUSE))
|
||||
.setVisibleInWhoisAsAdmin(true)
|
||||
.setVisibleInWhoisAsTech(true)
|
||||
.setVisibleInDomainWhoisAsAbuse(true)
|
||||
.build());
|
||||
runCommandForced("--mode=UPDATE", "--email=john.doe@example.com", "NewRegistrar");
|
||||
RegistrarContact registrarContact = loadRegistrar("NewRegistrar").getContacts().asList().get(1);
|
||||
assertThat(registrarContact.getEmailAddress()).isEqualTo(existingContact.getEmailAddress());
|
||||
assertThat(registrarContact.getName()).isEqualTo(existingContact.getName());
|
||||
assertThat(registrarContact.getGaeUserId()).isEqualTo(existingContact.getGaeUserId());
|
||||
assertThat(registrarContact.getPhoneNumber()).isEqualTo(existingContact.getPhoneNumber());
|
||||
assertThat(registrarContact.getFaxNumber()).isEqualTo(existingContact.getFaxNumber());
|
||||
assertThat(registrarContact.getTypes()).isEqualTo(existingContact.getTypes());
|
||||
assertThat(registrarContact.getVisibleInWhoisAsAdmin())
|
||||
RegistrarPoc registrarPoc = loadRegistrar("NewRegistrar").getContacts().asList().get(1);
|
||||
assertThat(registrarPoc.getEmailAddress()).isEqualTo(existingContact.getEmailAddress());
|
||||
assertThat(registrarPoc.getName()).isEqualTo(existingContact.getName());
|
||||
assertThat(registrarPoc.getGaeUserId()).isEqualTo(existingContact.getGaeUserId());
|
||||
assertThat(registrarPoc.getPhoneNumber()).isEqualTo(existingContact.getPhoneNumber());
|
||||
assertThat(registrarPoc.getFaxNumber()).isEqualTo(existingContact.getFaxNumber());
|
||||
assertThat(registrarPoc.getTypes()).isEqualTo(existingContact.getTypes());
|
||||
assertThat(registrarPoc.getVisibleInWhoisAsAdmin())
|
||||
.isEqualTo(existingContact.getVisibleInWhoisAsAdmin());
|
||||
assertThat(registrarContact.getVisibleInWhoisAsTech())
|
||||
assertThat(registrarPoc.getVisibleInWhoisAsTech())
|
||||
.isEqualTo(existingContact.getVisibleInWhoisAsTech());
|
||||
assertThat(registrarContact.getVisibleInDomainWhoisAsAbuse())
|
||||
assertThat(registrarPoc.getVisibleInDomainWhoisAsAbuse())
|
||||
.isEqualTo(existingContact.getVisibleInDomainWhoisAsAbuse());
|
||||
}
|
||||
|
||||
|
@ -253,8 +255,8 @@ class RegistrarContactCommandTest extends CommandTestCase<RegistrarContactComman
|
|||
void testUpdate_listOfTypesWorks() throws Exception {
|
||||
Registrar registrar = loadRegistrar("NewRegistrar");
|
||||
persistSimpleResource(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("John Doe")
|
||||
.setEmailAddress("john.doe@example.com")
|
||||
.setGaeUserId("11111")
|
||||
|
@ -270,16 +272,16 @@ class RegistrarContactCommandTest extends CommandTestCase<RegistrarContactComman
|
|||
"--email=john.doe@example.com",
|
||||
"--contact_type=ADMIN,TECH",
|
||||
"NewRegistrar");
|
||||
RegistrarContact registrarContact = loadRegistrar("NewRegistrar").getContacts().asList().get(1);
|
||||
assertThat(registrarContact.getTypes()).containsExactly(ADMIN, TECH);
|
||||
RegistrarPoc registrarPoc = loadRegistrar("NewRegistrar").getContacts().asList().get(1);
|
||||
assertThat(registrarPoc.getTypes()).containsExactly(ADMIN, TECH);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testUpdate_clearAllTypes() throws Exception {
|
||||
Registrar registrar = loadRegistrar("NewRegistrar");
|
||||
persistSimpleResource(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("John Doe")
|
||||
.setEmailAddress("john.doe@example.com")
|
||||
.setTypes(ImmutableSet.of(ADMIN, ABUSE))
|
||||
|
@ -289,8 +291,8 @@ class RegistrarContactCommandTest extends CommandTestCase<RegistrarContactComman
|
|||
"--email=john.doe@example.com",
|
||||
"--contact_type=",
|
||||
"NewRegistrar");
|
||||
RegistrarContact registrarContact = loadRegistrar("NewRegistrar").getContacts().asList().get(1);
|
||||
assertThat(registrarContact.getTypes()).isEmpty();
|
||||
RegistrarPoc registrarPoc = loadRegistrar("NewRegistrar").getContacts().asList().get(1);
|
||||
assertThat(registrarPoc.getTypes()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -306,11 +308,11 @@ class RegistrarContactCommandTest extends CommandTestCase<RegistrarContactComman
|
|||
"--visible_in_whois_as_tech=false",
|
||||
"--visible_in_domain_whois_as_abuse=true",
|
||||
"NewRegistrar");
|
||||
RegistrarContact registrarContact = loadRegistrar("NewRegistrar").getContacts().asList().get(1);
|
||||
assertThat(registrarContact)
|
||||
RegistrarPoc registrarPoc = loadRegistrar("NewRegistrar").getContacts().asList().get(1);
|
||||
assertThat(registrarPoc)
|
||||
.isEqualTo(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Jim Doe")
|
||||
.setEmailAddress("jim.doe@example.com")
|
||||
.setRegistryLockEmailAddress("jim.doe@external.com")
|
||||
|
@ -319,7 +321,7 @@ class RegistrarContactCommandTest extends CommandTestCase<RegistrarContactComman
|
|||
.setVisibleInWhoisAsTech(false)
|
||||
.setVisibleInDomainWhoisAsAbuse(true)
|
||||
.build());
|
||||
assertThat(registrarContact.getGaeUserId()).isNull();
|
||||
assertThat(registrarPoc.getGaeUserId()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -334,8 +336,8 @@ class RegistrarContactCommandTest extends CommandTestCase<RegistrarContactComman
|
|||
|
||||
@Test
|
||||
void testDelete_failsOnDomainWhoisAbuseContact() {
|
||||
RegistrarContact registrarContact = loadRegistrar("NewRegistrar").getContacts().asList().get(0);
|
||||
putInDb(registrarContact.asBuilder().setVisibleInDomainWhoisAsAbuse(true).build());
|
||||
RegistrarPoc registrarPoc = loadRegistrar("NewRegistrar").getContacts().asList().get(0);
|
||||
putInDb(registrarPoc.asBuilder().setVisibleInDomainWhoisAsAbuse(true).build());
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
|
@ -355,16 +357,16 @@ class RegistrarContactCommandTest extends CommandTestCase<RegistrarContactComman
|
|||
"--allow_console_access=true",
|
||||
"--contact_type=ADMIN,ABUSE",
|
||||
"NewRegistrar");
|
||||
RegistrarContact registrarContact = loadRegistrar("NewRegistrar").getContacts().asList().get(1);
|
||||
assertThat(registrarContact.getGaeUserId()).matches("-?[0-9]+");
|
||||
RegistrarPoc registrarPoc = loadRegistrar("NewRegistrar").getContacts().asList().get(1);
|
||||
assertThat(registrarPoc.getGaeUserId()).matches("-?[0-9]+");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreate_withNoContactTypes() throws Exception {
|
||||
runCommandForced(
|
||||
"--mode=CREATE", "--name=Jim Doe", "--email=jim.doe@example.com", "NewRegistrar");
|
||||
RegistrarContact registrarContact = loadRegistrar("NewRegistrar").getContacts().asList().get(1);
|
||||
assertThat(registrarContact.getTypes()).isEmpty();
|
||||
RegistrarPoc registrarPoc = loadRegistrar("NewRegistrar").getContacts().asList().get(1);
|
||||
assertThat(registrarPoc.getTypes()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -387,27 +389,27 @@ class RegistrarContactCommandTest extends CommandTestCase<RegistrarContactComman
|
|||
"--registry_lock_email=jim.doe.registry.lock@example.com",
|
||||
"--allowed_to_set_registry_lock_password=true",
|
||||
"NewRegistrar");
|
||||
RegistrarContact registrarContact = loadRegistrar("NewRegistrar").getContacts().asList().get(1);
|
||||
assertThat(registrarContact.isAllowedToSetRegistryLockPassword()).isTrue();
|
||||
registrarContact.asBuilder().setRegistryLockPassword("foo");
|
||||
RegistrarPoc registrarPoc = loadRegistrar("NewRegistrar").getContacts().asList().get(1);
|
||||
assertThat(registrarPoc.isAllowedToSetRegistryLockPassword()).isTrue();
|
||||
registrarPoc.asBuilder().setRegistryLockPassword("foo");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testUpdate_setAllowedToSetRegistryLockPassword() throws Exception {
|
||||
Registrar registrar = loadRegistrar("NewRegistrar");
|
||||
RegistrarContact registrarContact =
|
||||
RegistrarPoc registrarPoc =
|
||||
persistSimpleResource(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Jim Doe")
|
||||
.setEmailAddress("jim.doe@example.com")
|
||||
.build());
|
||||
assertThat(registrarContact.isAllowedToSetRegistryLockPassword()).isFalse();
|
||||
assertThat(registrarPoc.isAllowedToSetRegistryLockPassword()).isFalse();
|
||||
|
||||
// First, try (and fail) to set the password directly
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> registrarContact.asBuilder().setRegistryLockPassword("foo"));
|
||||
() -> registrarPoc.asBuilder().setRegistryLockPassword("foo"));
|
||||
|
||||
// Next, try (and fail) to allow registry lock without a registry lock email
|
||||
assertThat(
|
||||
|
@ -429,7 +431,7 @@ class RegistrarContactCommandTest extends CommandTestCase<RegistrarContactComman
|
|||
"--registry_lock_email=jim.doe.registry.lock@example.com",
|
||||
"--allowed_to_set_registry_lock_password=true",
|
||||
"NewRegistrar");
|
||||
RegistrarContact newContact = reloadResource(registrarContact);
|
||||
RegistrarPoc newContact = reloadResource(registrarPoc);
|
||||
assertThat(newContact.isAllowedToSetRegistryLockPassword()).isTrue();
|
||||
// should be allowed to set the password now
|
||||
newContact.asBuilder().setRegistryLockPassword("foo");
|
||||
|
@ -438,25 +440,25 @@ class RegistrarContactCommandTest extends CommandTestCase<RegistrarContactComman
|
|||
@Test
|
||||
void testUpdate_setAllowedToSetRegistryLockPassword_removesOldPassword() throws Exception {
|
||||
Registrar registrar = loadRegistrar("NewRegistrar");
|
||||
RegistrarContact registrarContact =
|
||||
RegistrarPoc registrarPoc =
|
||||
persistSimpleResource(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Jim Doe")
|
||||
.setEmailAddress("jim.doe@example.com")
|
||||
.setRegistryLockEmailAddress("jim.doe.registry.lock@example.com")
|
||||
.setAllowedToSetRegistryLockPassword(true)
|
||||
.setRegistryLockPassword("hi")
|
||||
.build());
|
||||
assertThat(registrarContact.verifyRegistryLockPassword("hi")).isTrue();
|
||||
assertThat(registrarContact.verifyRegistryLockPassword("hello")).isFalse();
|
||||
assertThat(registrarPoc.verifyRegistryLockPassword("hi")).isTrue();
|
||||
assertThat(registrarPoc.verifyRegistryLockPassword("hello")).isFalse();
|
||||
runCommandForced(
|
||||
"--mode=UPDATE",
|
||||
"--email=jim.doe@example.com",
|
||||
"--allowed_to_set_registry_lock_password=true",
|
||||
"NewRegistrar");
|
||||
registrarContact = reloadResource(registrarContact);
|
||||
assertThat(registrarContact.verifyRegistryLockPassword("hi")).isFalse();
|
||||
registrarPoc = reloadResource(registrarPoc);
|
||||
assertThat(registrarPoc.verifyRegistryLockPassword("hi")).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
|
@ -33,7 +33,7 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.model.tld.Registry;
|
||||
import google.registry.model.tld.Registry.TldState;
|
||||
import google.registry.testing.DeterministicStringGenerator;
|
||||
|
@ -109,13 +109,12 @@ class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
}
|
||||
|
||||
private void verifyRegistrarContactCreation(String registrarName, String email) {
|
||||
ImmutableSet<RegistrarContact> registrarContacts =
|
||||
loadRegistrar(registrarName).getContacts();
|
||||
assertThat(registrarContacts).hasSize(1);
|
||||
RegistrarContact registrarContact = registrarContacts.stream().findAny().get();
|
||||
assertThat(registrarContact.getEmailAddress()).isEqualTo(email);
|
||||
assertThat(registrarContact.getName()).isEqualTo(email);
|
||||
assertThat(registrarContact.getGaeUserId()).isNotNull();
|
||||
ImmutableSet<RegistrarPoc> registrarPocs = loadRegistrar(registrarName).getContacts();
|
||||
assertThat(registrarPocs).hasSize(1);
|
||||
RegistrarPoc registrarPoc = registrarPocs.stream().findAny().get();
|
||||
assertThat(registrarPoc.getEmailAddress()).isEqualTo(email);
|
||||
assertThat(registrarPoc.getName()).isEqualTo(email);
|
||||
assertThat(registrarPoc.getGaeUserId()).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -32,7 +32,7 @@ import com.google.common.collect.ImmutableSetMultimap;
|
|||
import google.registry.config.RegistryEnvironment;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarAddress;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.request.Action.Method;
|
||||
import google.registry.request.auth.AuthLevel;
|
||||
import google.registry.request.auth.AuthResult;
|
||||
|
@ -218,8 +218,8 @@ final class ConsoleRegistrarCreatorActionTest {
|
|||
|
||||
assertThat(registrar.getContacts())
|
||||
.containsExactly(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setGaeUserId("-1509175207")
|
||||
.setGaeUserId(convertEmailAddressToGaeUserId("myclientid@registry.example"))
|
||||
.setName("myclientid@registry.example")
|
||||
|
|
|
@ -23,8 +23,8 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Iterables;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarContact.Type;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.model.registrar.RegistrarPoc.Type;
|
||||
import google.registry.testing.AppEngineExtension;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -80,8 +80,7 @@ class ContactSettingsTest extends RegistrarSettingsActionTestCase {
|
|||
action.handleJsonRequest(ImmutableMap.of("op", "update", "id", CLIENT_ID, "args", regMap));
|
||||
assertThat(response).containsEntry("status", "SUCCESS");
|
||||
|
||||
RegistrarContact foundContact =
|
||||
Iterables.getOnlyElement(loadRegistrar(CLIENT_ID).getContacts());
|
||||
RegistrarPoc foundContact = Iterables.getOnlyElement(loadRegistrar(CLIENT_ID).getContacts());
|
||||
assertThat(foundContact.getName()).isEqualTo(adminContact.get("name"));
|
||||
assertThat(foundContact.getEmailAddress()).isEqualTo(adminContact.get("emailAddress"));
|
||||
assertThat(foundContact.getPhoneNumber()).isEqualTo(adminContact.get("phoneNumber"));
|
||||
|
@ -130,7 +129,7 @@ class ContactSettingsTest extends RegistrarSettingsActionTestCase {
|
|||
void testPost_updateContacts_cannotRemoveWhoisAbuseContact_error() {
|
||||
// First make the contact's info visible in whois as abuse contact info.
|
||||
Registrar registrar = loadRegistrar(CLIENT_ID);
|
||||
RegistrarContact rc =
|
||||
RegistrarPoc rc =
|
||||
AppEngineExtension.makeRegistrarContact2()
|
||||
.asBuilder()
|
||||
.setVisibleInDomainWhoisAsAbuse(true)
|
||||
|
@ -157,7 +156,7 @@ class ContactSettingsTest extends RegistrarSettingsActionTestCase {
|
|||
void testPost_updateContacts_whoisAbuseContactMustHavePhoneNumber_error() {
|
||||
// First make the contact's info visible in whois as abuse contact info.
|
||||
Registrar registrar = loadRegistrar(CLIENT_ID);
|
||||
RegistrarContact rc =
|
||||
RegistrarPoc rc =
|
||||
AppEngineExtension.makeRegistrarContact2()
|
||||
.asBuilder()
|
||||
.setVisibleInDomainWhoisAsAbuse(true)
|
||||
|
@ -184,7 +183,7 @@ class ContactSettingsTest extends RegistrarSettingsActionTestCase {
|
|||
void testSuccess_setRegistryLockPassword() {
|
||||
addPasswordToContactTwo();
|
||||
String emailAddress = AppEngineExtension.makeRegistrarContact2().getEmailAddress();
|
||||
RegistrarContact newContactWithPassword =
|
||||
RegistrarPoc newContactWithPassword =
|
||||
loadRegistrar(CLIENT_ID).getContacts().stream()
|
||||
.filter(rc -> rc.getEmailAddress().equals(emailAddress))
|
||||
.findFirst()
|
||||
|
@ -197,7 +196,7 @@ class ContactSettingsTest extends RegistrarSettingsActionTestCase {
|
|||
void testSuccess_setRegistryLockPassword_notOverriddenLater() {
|
||||
addPasswordToContactTwo();
|
||||
String emailAddress = AppEngineExtension.makeRegistrarContact2().getEmailAddress();
|
||||
RegistrarContact newContactWithPassword =
|
||||
RegistrarPoc newContactWithPassword =
|
||||
loadRegistrar(CLIENT_ID).getContacts().stream()
|
||||
.filter(rc -> rc.getEmailAddress().equals(emailAddress))
|
||||
.findFirst()
|
||||
|
@ -226,7 +225,7 @@ class ContactSettingsTest extends RegistrarSettingsActionTestCase {
|
|||
}
|
||||
|
||||
private void addPasswordToContactTwo() {
|
||||
RegistrarContact contact =
|
||||
RegistrarPoc contact =
|
||||
persistResource(
|
||||
AppEngineExtension.makeRegistrarContact2()
|
||||
.asBuilder()
|
||||
|
@ -331,7 +330,7 @@ class ContactSettingsTest extends RegistrarSettingsActionTestCase {
|
|||
addPasswordToContactTwo();
|
||||
Map<String, Object> reqJson = loadRegistrar(CLIENT_ID).toJsonMap();
|
||||
String emailAddress = AppEngineExtension.makeRegistrarContact2().getEmailAddress();
|
||||
RegistrarContact newContactWithPassword =
|
||||
RegistrarPoc newContactWithPassword =
|
||||
loadRegistrar(CLIENT_ID).getContacts().stream()
|
||||
.filter(rc -> rc.getEmailAddress().equals(emailAddress))
|
||||
.findFirst()
|
||||
|
|
|
@ -37,7 +37,7 @@ import com.google.common.collect.ImmutableSortedMap;
|
|||
import com.google.common.truth.Truth;
|
||||
import google.registry.flows.certs.CertificateChecker;
|
||||
import google.registry.model.ofy.Ofy;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.request.JsonActionRunner;
|
||||
import google.registry.request.JsonResponse;
|
||||
import google.registry.request.ResponseImpl;
|
||||
|
@ -94,7 +94,7 @@ public abstract class RegistrarSettingsActionTestCase {
|
|||
final RegistrarSettingsAction action = new RegistrarSettingsAction();
|
||||
private final StringWriter writer = new StringWriter();
|
||||
|
||||
RegistrarContact techContact;
|
||||
RegistrarPoc techContact;
|
||||
|
||||
CloudTasksHelper cloudTasksHelper = new CloudTasksHelper();
|
||||
|
||||
|
@ -107,7 +107,7 @@ public abstract class RegistrarSettingsActionTestCase {
|
|||
// Add a technical contact to the registrar (in addition to the default admin contact created by
|
||||
// AppEngineExtension).
|
||||
techContact =
|
||||
getOnlyElement(loadRegistrar(CLIENT_ID).getContactsOfType(RegistrarContact.Type.TECH));
|
||||
getOnlyElement(loadRegistrar(CLIENT_ID).getContactsOfType(RegistrarPoc.Type.TECH));
|
||||
|
||||
action.registrarAccessor = null;
|
||||
action.jsonActionRunner =
|
||||
|
|
|
@ -33,7 +33,7 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.google.common.collect.ImmutableSetMultimap;
|
||||
import com.google.gson.Gson;
|
||||
import google.registry.model.domain.RegistryLock;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.request.Action.Method;
|
||||
import google.registry.request.auth.AuthLevel;
|
||||
import google.registry.request.auth.AuthResult;
|
||||
|
@ -70,7 +70,7 @@ final class RegistryLockGetActionTest {
|
|||
|
||||
@BeforeEach
|
||||
void beforeEach() {
|
||||
user = userFromRegistrarContact(AppEngineExtension.makeRegistrarContact3());
|
||||
user = userFromRegistrarPoc(AppEngineExtension.makeRegistrarContact3());
|
||||
fakeClock.setTo(DateTime.parse("2000-06-08T22:00:00.0Z"));
|
||||
authResult = AuthResult.create(AuthLevel.USER, UserAuthInfo.create(user, false));
|
||||
accessor =
|
||||
|
@ -356,8 +356,7 @@ final class RegistryLockGetActionTest {
|
|||
assertThat(response.getStatus()).isEqualTo(SC_FORBIDDEN);
|
||||
}
|
||||
|
||||
static User userFromRegistrarContact(RegistrarContact registrarContact) {
|
||||
return new User(
|
||||
registrarContact.getEmailAddress(), "gmail.com", registrarContact.getGaeUserId());
|
||||
static User userFromRegistrarPoc(RegistrarPoc registrarPoc) {
|
||||
return new User(registrarPoc.getEmailAddress(), "gmail.com", registrarPoc.getGaeUserId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import static google.registry.testing.SqlHelper.getMostRecentRegistryLockByRepoI
|
|||
import static google.registry.testing.SqlHelper.getRegistryLockByVerificationCode;
|
||||
import static google.registry.testing.SqlHelper.saveRegistryLock;
|
||||
import static google.registry.tools.LockOrUnlockDomainCommand.REGISTRY_LOCK_STATUSES;
|
||||
import static google.registry.ui.server.registrar.RegistryLockGetActionTest.userFromRegistrarContact;
|
||||
import static google.registry.ui.server.registrar.RegistryLockGetActionTest.userFromRegistrarPoc;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
@ -99,8 +99,8 @@ final class RegistryLockPostActionTest {
|
|||
|
||||
@BeforeEach
|
||||
void beforeEach() throws Exception {
|
||||
userWithLockPermission = userFromRegistrarContact(AppEngineExtension.makeRegistrarContact3());
|
||||
userWithoutPermission = userFromRegistrarContact(AppEngineExtension.makeRegistrarContact2());
|
||||
userWithLockPermission = userFromRegistrarPoc(AppEngineExtension.makeRegistrarContact3());
|
||||
userWithoutPermission = userFromRegistrarPoc(AppEngineExtension.makeRegistrarContact2());
|
||||
createTld("tld");
|
||||
domain = persistResource(newDomainBase("example.tld"));
|
||||
|
||||
|
@ -314,7 +314,7 @@ final class RegistryLockPostActionTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
void testFailure_notEnabledForRegistrarContact() {
|
||||
void testFailure_notEnabledForRegistrarPoc() {
|
||||
action =
|
||||
createAction(
|
||||
AuthResult.create(AuthLevel.USER, UserAuthInfo.create(userWithoutPermission, false)));
|
||||
|
|
|
@ -34,7 +34,7 @@ import google.registry.model.domain.DomainBase;
|
|||
import google.registry.model.domain.RegistryLock;
|
||||
import google.registry.model.ofy.OfyFilter;
|
||||
import google.registry.model.registrar.Registrar.State;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.module.frontend.FrontendServlet;
|
||||
import google.registry.server.RegistryTestServer;
|
||||
import google.registry.testing.AppEngineExtension;
|
||||
|
@ -181,7 +181,7 @@ class RegistrarConsoleScreenshotTest extends WebDriverTestCase {
|
|||
|
||||
server.runInAppEngineEnvironment(
|
||||
() -> {
|
||||
RegistrarContact contact =
|
||||
RegistrarPoc contact =
|
||||
loadRegistrar("TheRegistrar").getContacts().stream()
|
||||
.filter(c -> c.getEmailAddress().equals("johndoe@theregistrar.com"))
|
||||
.findFirst()
|
||||
|
|
|
@ -25,7 +25,7 @@ import com.googlecode.objectify.ObjectifyFilter;
|
|||
import google.registry.model.ofy.OfyFilter;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarAddress;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.module.frontend.FrontendServlet;
|
||||
import google.registry.server.RegistryTestServer;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
|
@ -179,10 +179,10 @@ public class RegistrarConsoleWebTest extends WebDriverTestCase {
|
|||
void testContactSettingsView() throws Throwable {
|
||||
driver.get(server.getUrl("/registrar#contact-settings"));
|
||||
driver.waitForDisplayedElement(By.id("reg-app-btn-add"));
|
||||
ImmutableList<RegistrarContact> contacts =
|
||||
ImmutableList<RegistrarPoc> contacts =
|
||||
server.runInAppEngineEnvironment(
|
||||
() -> loadRegistrar("TheRegistrar").getContacts().asList());
|
||||
for (RegistrarContact contact : contacts) {
|
||||
for (RegistrarPoc contact : contacts) {
|
||||
assertEltTextPresent(By.id("contacts[0].name"), contact.getName());
|
||||
assertEltTextPresent(By.id("contacts[0].emailAddress"), contact.getEmailAddress());
|
||||
assertEltTextPresent(By.id("contacts[0].phoneNumber"), contact.getPhoneNumber());
|
||||
|
|
|
@ -35,7 +35,7 @@ import google.registry.model.domain.secdns.DelegationSignerData;
|
|||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.host.HostResource;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.persistence.VKey;
|
||||
import google.registry.testing.AppEngineExtension;
|
||||
import google.registry.testing.DualDatabaseTest;
|
||||
|
@ -55,7 +55,7 @@ class DomainWhoisResponseTest {
|
|||
|
||||
private HostResource hostResource1;
|
||||
private HostResource hostResource2;
|
||||
private RegistrarContact abuseContact;
|
||||
private RegistrarPoc abuseContact;
|
||||
private ContactResource adminContact;
|
||||
private ContactResource registrant;
|
||||
private ContactResource techContact;
|
||||
|
@ -74,14 +74,15 @@ class DomainWhoisResponseTest {
|
|||
.setIanaIdentifier(5555555L)
|
||||
.build());
|
||||
|
||||
abuseContact = persistResource(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
.setName("Jake Doe")
|
||||
.setEmailAddress("jakedoe@theregistrar.com")
|
||||
.setPhoneNumber("+1.2125551216")
|
||||
.setVisibleInDomainWhoisAsAbuse(true)
|
||||
.build());
|
||||
abuseContact =
|
||||
persistResource(
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Jake Doe")
|
||||
.setEmailAddress("jakedoe@theregistrar.com")
|
||||
.setPhoneNumber("+1.2125551216")
|
||||
.setVisibleInDomainWhoisAsAbuse(true)
|
||||
.build());
|
||||
|
||||
createTld("tld");
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarAddress;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.model.registrar.RegistrarPoc;
|
||||
import google.registry.testing.AppEngineExtension;
|
||||
import google.registry.testing.FakeClock;
|
||||
import google.registry.whois.WhoisResponse.WhoisResponseResults;
|
||||
|
@ -64,50 +64,50 @@ class RegistrarWhoisResponseTest {
|
|||
.setUrl("http://my.fake.url")
|
||||
.build();
|
||||
// Use the registrar key for contacts' parent.
|
||||
ImmutableList<RegistrarContact> contacts =
|
||||
ImmutableList<RegistrarPoc> contacts =
|
||||
ImmutableList.of(
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Joe Registrar")
|
||||
.setEmailAddress("joeregistrar@example-registrar.tld")
|
||||
.setPhoneNumber("+1.3105551213")
|
||||
.setFaxNumber("+1.3105551213")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.ADMIN))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.ADMIN))
|
||||
.setVisibleInWhoisAsAdmin(true)
|
||||
.setVisibleInWhoisAsTech(false)
|
||||
.build(),
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("John Doe")
|
||||
.setEmailAddress("johndoe@example-registrar.tld")
|
||||
.setPhoneNumber("+1.1111111111")
|
||||
.setFaxNumber("+1.1111111111")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.ADMIN))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.ADMIN))
|
||||
.build(),
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Jane Registrar")
|
||||
.setEmailAddress("janeregistrar@example-registrar.tld")
|
||||
.setPhoneNumber("+1.3105551214")
|
||||
.setFaxNumber("+1.3105551213")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.ADMIN))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.ADMIN))
|
||||
.setVisibleInWhoisAsAdmin(true)
|
||||
.build(),
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Jane Doe")
|
||||
.setEmailAddress("janedoe@example-registrar.tld")
|
||||
.setPhoneNumber("+1.1111111112")
|
||||
.setFaxNumber("+1.1111111112")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.TECH))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.TECH))
|
||||
.build(),
|
||||
new RegistrarContact.Builder()
|
||||
.setParent(registrar)
|
||||
new RegistrarPoc.Builder()
|
||||
.setRegistrar(registrar)
|
||||
.setName("Bonnie & Clyde")
|
||||
.setEmailAddress("johngeek@example-registrar.tld")
|
||||
.setPhoneNumber("+1.3105551215")
|
||||
.setFaxNumber("+1.3105551216")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.TECH))
|
||||
.setTypes(ImmutableSet.of(RegistrarPoc.Type.TECH))
|
||||
.setVisibleInWhoisAsTech(true)
|
||||
.build());
|
||||
persistResource(registrar);
|
||||
|
|
|
@ -17,5 +17,4 @@ PollMessage
|
|||
RdeRevision
|
||||
Recurring
|
||||
Registrar
|
||||
RegistrarContact
|
||||
Registry
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
Cursor
|
||||
Registrar
|
||||
RegistrarContact
|
||||
Registry
|
||||
ServerSecret
|
||||
|
|
|
@ -13,5 +13,4 @@ OneTime
|
|||
PollMessage
|
||||
Recurring
|
||||
Registrar
|
||||
RegistrarContact
|
||||
Registry
|
||||
|
|
|
@ -590,31 +590,6 @@ class google.registry.model.registrar.RegistrarAddress {
|
|||
java.lang.String zip;
|
||||
java.util.List<java.lang.String> street;
|
||||
}
|
||||
class google.registry.model.registrar.RegistrarContact {
|
||||
@Id java.lang.String emailAddress;
|
||||
@Parent com.googlecode.objectify.Key<google.registry.model.registrar.Registrar> parent;
|
||||
boolean allowedToSetRegistryLockPassword;
|
||||
boolean visibleInDomainWhoisAsAbuse;
|
||||
boolean visibleInWhoisAsAdmin;
|
||||
boolean visibleInWhoisAsTech;
|
||||
java.lang.String faxNumber;
|
||||
java.lang.String gaeUserId;
|
||||
java.lang.String name;
|
||||
java.lang.String phoneNumber;
|
||||
java.lang.String registryLockEmailAddress;
|
||||
java.lang.String registryLockPasswordHash;
|
||||
java.lang.String registryLockPasswordSalt;
|
||||
java.util.Set<google.registry.model.registrar.RegistrarContact$Type> types;
|
||||
}
|
||||
enum google.registry.model.registrar.RegistrarContact$Type {
|
||||
ABUSE;
|
||||
ADMIN;
|
||||
BILLING;
|
||||
LEGAL;
|
||||
MARKETING;
|
||||
TECH;
|
||||
WHOIS;
|
||||
}
|
||||
class google.registry.model.replay.LastSqlTransaction {
|
||||
@Id long id;
|
||||
long transactionId;
|
||||
|
|
|
@ -11,9 +11,9 @@ emailAddress: the.registrar@example.com -> thase@the.registrar
|
|||
url: http://my.fake.url -> http://my.new.url
|
||||
contacts:
|
||||
ADDED:
|
||||
{parent=Key<?>(EntityGroupRoot("cross-tld")/Registrar("TheRegistrar")), name=Extra Terrestrial, emailAddress=etphonehome@example.com, registrarId=TheRegistrar, registryLockEmailAddress=null, phoneNumber=+1.2345678901, faxNumber=null, types=[ADMIN, BILLING, TECH, WHOIS], gaeUserId=null, visibleInWhoisAsAdmin=true, visibleInWhoisAsTech=false, visibleInDomainWhoisAsAbuse=false, allowedToSetRegistryLockPassword=false}
|
||||
{name=Extra Terrestrial, emailAddress=etphonehome@example.com, registrarId=TheRegistrar, registryLockEmailAddress=null, phoneNumber=+1.2345678901, faxNumber=null, types=[ADMIN, BILLING, TECH, WHOIS], gaeUserId=null, visibleInWhoisAsAdmin=true, visibleInWhoisAsTech=false, visibleInDomainWhoisAsAbuse=false, allowedToSetRegistryLockPassword=false}
|
||||
REMOVED:
|
||||
{parent=Key<?>(EntityGroupRoot("cross-tld")/Registrar("TheRegistrar")), name=John Doe, emailAddress=johndoe@theregistrar.com, registrarId=TheRegistrar, registryLockEmailAddress=null, phoneNumber=+1.1234567890, faxNumber=null, types=[ADMIN], gaeUserId=31337, visibleInWhoisAsAdmin=false, visibleInWhoisAsTech=false, visibleInDomainWhoisAsAbuse=false, allowedToSetRegistryLockPassword=false}
|
||||
{name=John Doe, emailAddress=johndoe@theregistrar.com, registrarId=TheRegistrar, registryLockEmailAddress=null, phoneNumber=+1.1234567890, faxNumber=null, types=[ADMIN], gaeUserId=31337, visibleInWhoisAsAdmin=false, visibleInWhoisAsTech=false, visibleInDomainWhoisAsAbuse=false, allowedToSetRegistryLockPassword=false}
|
||||
FINAL CONTENTS:
|
||||
{parent=Key<?>(EntityGroupRoot("cross-tld")/Registrar("TheRegistrar")), name=Extra Terrestrial, emailAddress=etphonehome@example.com, registrarId=TheRegistrar, registryLockEmailAddress=null, phoneNumber=+1.2345678901, faxNumber=null, types=[ADMIN, BILLING, TECH, WHOIS], gaeUserId=null, visibleInWhoisAsAdmin=true, visibleInWhoisAsTech=false, visibleInDomainWhoisAsAbuse=false, allowedToSetRegistryLockPassword=false},
|
||||
{parent=Key<?>(EntityGroupRoot("cross-tld")/Registrar("TheRegistrar")), name=Marla Singer, emailAddress=Marla.Singer@crr.com, registrarId=TheRegistrar, registryLockEmailAddress=Marla.Singer.RegistryLock@crr.com, phoneNumber=+1.2128675309, faxNumber=null, types=[TECH], gaeUserId=12345, visibleInWhoisAsAdmin=false, visibleInWhoisAsTech=false, visibleInDomainWhoisAsAbuse=false, allowedToSetRegistryLockPassword=false}
|
||||
{name=Extra Terrestrial, emailAddress=etphonehome@example.com, registrarId=TheRegistrar, registryLockEmailAddress=null, phoneNumber=+1.2345678901, faxNumber=null, types=[ADMIN, BILLING, TECH, WHOIS], gaeUserId=null, visibleInWhoisAsAdmin=true, visibleInWhoisAsTech=false, visibleInDomainWhoisAsAbuse=false, allowedToSetRegistryLockPassword=false},
|
||||
{name=Marla Singer, emailAddress=Marla.Singer@crr.com, registrarId=TheRegistrar, registryLockEmailAddress=Marla.Singer.RegistryLock@crr.com, phoneNumber=+1.2128675309, faxNumber=null, types=[TECH], gaeUserId=12345, visibleInWhoisAsAdmin=false, visibleInWhoisAsTech=false, visibleInDomainWhoisAsAbuse=false, allowedToSetRegistryLockPassword=false}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue