mirror of
https://github.com/google/nomulus
synced 2026-01-09 07:33:42 +00:00
Standardize usage of some transfer flow verification helpers
We were using verifyHasPendingTransfer() only in the domain transfer flows; now we use it in both. I also added a helper verifyTransferInitiator() even though it's only used in two places (the transfer cancel flows), because I think it streamlines the flow and makes it more consistent with the whole section of verification checking. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=150324823
This commit is contained in:
@@ -41,6 +41,7 @@ import google.registry.flows.EppException.ParameterValuePolicyErrorException;
|
||||
import google.registry.flows.EppException.ParameterValueRangeErrorException;
|
||||
import google.registry.flows.exceptions.MissingTransferRequestAuthInfoException;
|
||||
import google.registry.flows.exceptions.NotPendingTransferException;
|
||||
import google.registry.flows.exceptions.NotTransferInitiatorException;
|
||||
import google.registry.flows.exceptions.ResourceAlreadyExistsException;
|
||||
import google.registry.flows.exceptions.ResourceStatusProhibitsOperationException;
|
||||
import google.registry.flows.exceptions.ResourceToDeleteIsReferencedException;
|
||||
@@ -288,6 +289,13 @@ public final class ResourceFlowUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static <R extends EppResource & ResourceWithTransferData> void verifyTransferInitiator(
|
||||
String clientId, R resource) throws NotTransferInitiatorException {
|
||||
if (!resource.getTransferData().getGainingClientId().equals(clientId)) {
|
||||
throw new NotTransferInitiatorException();
|
||||
}
|
||||
}
|
||||
|
||||
public static <R extends EppResource & ForeignKeyedEppResource> R loadAndVerifyExistence(
|
||||
Class<R> clazz, String targetId, DateTime now)
|
||||
throws ResourceDoesNotExistException {
|
||||
|
||||
Reference in New Issue
Block a user