mirror of
https://github.com/google/nomulus
synced 2026-01-09 07:33:42 +00:00
Add RDAP support for deleted nameservers and filtering by registrar
This CL adds the functionality for nameserver searches. Future CLs will handle domains and entities. Deleted items can only be seen by admins, and by registrars viewing their own deleted items. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=170106014
This commit is contained in:
@@ -17,6 +17,7 @@ package google.registry.rdap;
|
||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.request.Action.Method.GET;
|
||||
import static google.registry.request.Action.Method.HEAD;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import google.registry.model.host.HostResource;
|
||||
@@ -59,8 +60,12 @@ public class RdapNameserverAction extends RdapActionBase {
|
||||
pathSearchString = canonicalizeName(pathSearchString);
|
||||
// The RDAP syntax is /rdap/nameserver/ns1.mydomain.com.
|
||||
validateDomainName(pathSearchString);
|
||||
HostResource hostResource = loadByForeignKey(HostResource.class, pathSearchString, now);
|
||||
if (hostResource == null) {
|
||||
// If there are no undeleted nameservers with the given name, the foreign key should point to
|
||||
// the most recently deleted one.
|
||||
HostResource hostResource =
|
||||
loadByForeignKey(
|
||||
HostResource.class, pathSearchString, shouldIncludeDeleted() ? START_OF_TIME : now);
|
||||
if ((hostResource == null) || !shouldBeVisible(hostResource, now)) {
|
||||
throw new NotFoundException(pathSearchString + " not found");
|
||||
}
|
||||
return rdapJsonFormatter.makeRdapJsonForHost(
|
||||
|
||||
Reference in New Issue
Block a user