mirror of
https://github.com/google/nomulus.git
synced 2025-06-27 06:44:51 +02:00
RDAP: Add "last update of RDAP database" event
The ICANN operational profile says: 1.4.12. An entity object within an RDAP response MUST contain an events member with the following events: o An event of eventAction type registration. o An event of eventAction type last changed. The event of eventAction type last changed MUST be omitted if the Contact Object (as defined in RFC5733) has not been updated since it was created. o An event of eventAction type last update of RDAP database. It has similar wording for domains and hosts. The registration and last changed events are already being generated. This CL adds a "last update of RDAP database" event for all three object types. It's very redundant, and I have warned ICANN that "last update" doesn't mean what they might expect in the context of an eventually consistent database, but there we are. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=130279688
This commit is contained in:
parent
82ab624b36
commit
19da9a1531
30 changed files with 302 additions and 67 deletions
|
@ -31,6 +31,7 @@ import google.registry.request.HttpException.BadRequestException;
|
|||
import google.registry.request.HttpException.NotFoundException;
|
||||
import google.registry.util.Clock;
|
||||
import javax.inject.Inject;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* RDAP (new WHOIS) action for entity (contact and registrar) requests.
|
||||
|
@ -58,6 +59,7 @@ public class RdapEntityAction extends RdapActionBase {
|
|||
@Override
|
||||
public ImmutableMap<String, Object> getJsonObjectForResource(
|
||||
String pathSearchString, boolean isHeadRequest, String linkBase) throws HttpException {
|
||||
DateTime now = clock.nowUtc();
|
||||
// The query string is not used; the RDAP syntax is /rdap/entity/handle (the handle is the roid
|
||||
// for contacts and the client identifier for registrars). Since RDAP's concept of an entity
|
||||
// includes both contacts and registrars, search for one first, then the other.
|
||||
|
@ -68,13 +70,14 @@ public class RdapEntityAction extends RdapActionBase {
|
|||
ContactResource contactResource = ofy().load().key(contactKey).now();
|
||||
// As per Andy Newton on the regext mailing list, contacts by themselves have no role, since
|
||||
// they are global, and might have different roles for different domains.
|
||||
if ((contactResource != null) && clock.nowUtc().isBefore(contactResource.getDeletionTime())) {
|
||||
if ((contactResource != null) && now.isBefore(contactResource.getDeletionTime())) {
|
||||
return RdapJsonFormatter.makeRdapJsonForContact(
|
||||
contactResource,
|
||||
true,
|
||||
Optional.<DesignatedContact.Type>absent(),
|
||||
rdapLinkBase,
|
||||
rdapWhoisServer);
|
||||
rdapWhoisServer,
|
||||
now);
|
||||
}
|
||||
}
|
||||
String clientId = pathSearchString.trim();
|
||||
|
@ -83,7 +86,7 @@ public class RdapEntityAction extends RdapActionBase {
|
|||
Registrar registrar = Registrar.loadByClientId(clientId);
|
||||
if ((registrar != null) && registrar.isActiveAndPubliclyVisible()) {
|
||||
return RdapJsonFormatter.makeRdapJsonForRegistrar(
|
||||
registrar, true, rdapLinkBase, rdapWhoisServer);
|
||||
registrar, true, rdapLinkBase, rdapWhoisServer, now);
|
||||
}
|
||||
}
|
||||
throw !wasValidKey
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue