From 9546408a3a9a98da45218b78e88ebbab086180e7 Mon Sep 17 00:00:00 2001 From: Pavlo Tkach <3469726+ptkach@users.noreply.github.com> Date: Tue, 8 Nov 2022 16:40:50 -0500 Subject: [PATCH] Allow status, crDate, upDate, trDate, exDate and ns fields for all Domain Info responses (#1842) --- .../registry/flows/domain/DomainInfoFlow.java | 15 ++++++++------- .../domain_info_response_superuser_package.xml | 9 +++++++++ .../domain/domain_info_response_unauthorized.xml | 9 +++++++++ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/google/registry/flows/domain/DomainInfoFlow.java b/core/src/main/java/google/registry/flows/domain/DomainInfoFlow.java index 4275ec245..05c2e603b 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainInfoFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainInfoFlow.java @@ -105,6 +105,7 @@ public final class DomainInfoFlow implements Flow { verifyOptionalAuthInfo(authInfo, domain); flowCustomLogic.afterValidation( AfterValidationParameters.newBuilder().setDomain(domain).build()); + HostsRequest hostsRequest = ((Info) resourceCommand).getHostsRequest(); // Registrars can only see a few fields on unauthorized domains. // This is a policy decision that is left up to us by the rfcs. DomainInfoData.Builder infoBuilder = @@ -112,25 +113,25 @@ public final class DomainInfoFlow implements Flow { .setDomainName(domain.getDomainName()) .setRepoId(domain.getRepoId()) .setCurrentSponsorRegistrarId(domain.getCurrentSponsorRegistrarId()) + .setStatusValues(domain.getStatusValues()) + .setNameservers( + hostsRequest.requestDelegated() ? domain.loadNameserverHostNames() : null) + .setCreationTime(domain.getCreationTime()) + .setLastEppUpdateTime(domain.getLastEppUpdateTime()) + .setRegistrationExpirationTime(domain.getRegistrationExpirationTime()) + .setLastTransferTime(domain.getLastTransferTime()) .setRegistrant( tm().transact(() -> tm().loadByKey(domain.getRegistrant())).getContactId()); // If authInfo is non-null, then the caller is authorized to see the full information since we // will have already verified the authInfo is valid. if (registrarId.equals(domain.getCurrentSponsorRegistrarId()) || authInfo.isPresent()) { - HostsRequest hostsRequest = ((Info) resourceCommand).getHostsRequest(); infoBuilder - .setStatusValues(domain.getStatusValues()) .setContacts( tm().transact(() -> loadForeignKeyedDesignatedContacts(domain.getContacts()))) - .setNameservers(hostsRequest.requestDelegated() ? domain.loadNameserverHostNames() : null) .setSubordinateHosts( hostsRequest.requestSubordinate() ? domain.getSubordinateHosts() : null) .setCreationRegistrarId(domain.getCreationRegistrarId()) - .setCreationTime(domain.getCreationTime()) .setLastEppUpdateRegistrarId(domain.getLastEppUpdateRegistrarId()) - .setLastEppUpdateTime(domain.getLastEppUpdateTime()) - .setRegistrationExpirationTime(domain.getRegistrationExpirationTime()) - .setLastTransferTime(domain.getLastTransferTime()) .setAuthInfo(domain.getAuthInfo()); } BeforeResponseReturnData responseData = diff --git a/core/src/test/resources/google/registry/flows/domain/domain_info_response_superuser_package.xml b/core/src/test/resources/google/registry/flows/domain/domain_info_response_superuser_package.xml index 84a2608fe..e3797f409 100644 --- a/core/src/test/resources/google/registry/flows/domain/domain_info_response_superuser_package.xml +++ b/core/src/test/resources/google/registry/flows/domain/domain_info_response_superuser_package.xml @@ -8,8 +8,17 @@ xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"> example.tld %ROID% + jd1234 + + ns1.example.net + ns1.example.tld + NewRegistrar + 1999-04-03T22:00:00Z + 1999-12-03T09:00:00Z + 2005-04-03T22:00:00Z + 2000-04-08T09:00:00Z diff --git a/core/src/test/resources/google/registry/flows/domain/domain_info_response_unauthorized.xml b/core/src/test/resources/google/registry/flows/domain/domain_info_response_unauthorized.xml index c4058770e..39259352a 100644 --- a/core/src/test/resources/google/registry/flows/domain/domain_info_response_unauthorized.xml +++ b/core/src/test/resources/google/registry/flows/domain/domain_info_response_unauthorized.xml @@ -8,8 +8,17 @@ xmlns:domain="urn:ietf:params:xml:ns:domain-1.0"> example.tld %ROID% + jd1234 + + ns1.example.net + ns1.example.tld + NewRegistrar + 1999-04-03T22:00:00Z + 1999-12-03T09:00:00Z + 2005-04-03T22:00:00Z + 2000-04-08T09:00:00Z