mirror of
https://github.com/google/nomulus.git
synced 2025-08-11 12:09:39 +02:00
Add support for a domain transfer request superuser EPP extension
Allow superusers to change the transfer period to zero years and allow superusers to change the automatic transfer length. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=167598314
This commit is contained in:
parent
263aea3b2a
commit
2e4b63bb79
28 changed files with 1018 additions and 124 deletions
|
@ -29,8 +29,11 @@ import google.registry.flows.EppException.CommandUseErrorException;
|
|||
import google.registry.flows.EppException.SyntaxErrorException;
|
||||
import google.registry.flows.EppException.UnimplementedExtensionException;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.Superuser;
|
||||
import google.registry.flows.exceptions.OnlyToolCanPassMetadataException;
|
||||
import google.registry.flows.exceptions.UnauthorizedForSuperuserExtensionException;
|
||||
import google.registry.model.domain.metadata.MetadataExtension;
|
||||
import google.registry.model.domain.superuser.SuperuserExtension;
|
||||
import google.registry.model.eppinput.EppInput;
|
||||
import google.registry.model.eppinput.EppInput.CommandExtension;
|
||||
import google.registry.util.FormattingLogger;
|
||||
|
@ -56,6 +59,7 @@ public final class ExtensionManager {
|
|||
@Inject EppInput eppInput;
|
||||
@Inject SessionMetadata sessionMetadata;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @Superuser boolean isSuperuser;
|
||||
@Inject Class<? extends Flow> flowClass;
|
||||
@Inject EppRequestSource eppRequestSource;
|
||||
@Inject ExtensionManager() {}
|
||||
|
@ -107,11 +111,18 @@ public final class ExtensionManager {
|
|||
|
||||
private void checkForRestrictedExtensions(
|
||||
ImmutableSet<Class<? extends CommandExtension>> suppliedExtensions)
|
||||
throws OnlyToolCanPassMetadataException {
|
||||
throws OnlyToolCanPassMetadataException, UnauthorizedForSuperuserExtensionException {
|
||||
if (suppliedExtensions.contains(MetadataExtension.class)
|
||||
&& !eppRequestSource.equals(EppRequestSource.TOOL)) {
|
||||
throw new OnlyToolCanPassMetadataException();
|
||||
}
|
||||
// Can't use suppliedExtension.contains() here because the SuperuserExtension has child classes.
|
||||
for (Class<? extends CommandExtension> suppliedExtension : suppliedExtensions) {
|
||||
if (SuperuserExtension.class.isAssignableFrom(suppliedExtension)
|
||||
&& (!eppRequestSource.equals(EppRequestSource.TOOL) || !isSuperuser)) {
|
||||
throw new UnauthorizedForSuperuserExtensionException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkForDuplicateExtensions(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue