mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Default clientId to registry's registrar in domain lock commands
All domain locks we've processed so far are as a result of the URS process, for which the clientId is always that of the registry's registrar. So it makes sense to default to that value, while still retaining the option to specify it if required in case we ever support registrar-requested registry locks in the future. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=199350120
This commit is contained in:
parent
897690119e
commit
5c7a20797e
4 changed files with 41 additions and 3 deletions
|
@ -23,8 +23,10 @@ import static google.registry.util.CollectionUtils.findDuplicates;
|
|||
import com.beust.jcommander.Parameter;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.config.RegistryConfig.Config;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
|
||||
/** Shared base class for commands to registry lock or unlock a domain via EPP. */
|
||||
public abstract class LockOrUnlockDomainCommand extends MutatingEppToolCommand {
|
||||
|
@ -35,14 +37,17 @@ public abstract class LockOrUnlockDomainCommand extends MutatingEppToolCommand {
|
|||
|
||||
@Parameter(
|
||||
names = {"-c", "--client"},
|
||||
description = "Client identifier of the registrar to execute the command as",
|
||||
required = true
|
||||
)
|
||||
description =
|
||||
"Client ID of the requesting registrar if applicable, otherwise the registry registrar")
|
||||
String clientId;
|
||||
|
||||
@Parameter(description = "Names of the domains", required = true)
|
||||
private List<String> mainParameters;
|
||||
|
||||
@Inject
|
||||
@Config("registryAdminClientId")
|
||||
String registryAdminClientId;
|
||||
|
||||
protected ImmutableSet<String> getDomains() {
|
||||
return ImmutableSet.copyOf(mainParameters);
|
||||
}
|
||||
|
@ -51,6 +56,11 @@ public abstract class LockOrUnlockDomainCommand extends MutatingEppToolCommand {
|
|||
protected void initEppToolCommand() throws Exception {
|
||||
// Superuser status is required to update registry lock statuses.
|
||||
superuser = true;
|
||||
|
||||
// Default clientId to the registry registrar account if otherwise unspecified.
|
||||
if (clientId == null) {
|
||||
clientId = registryAdminClientId;
|
||||
}
|
||||
String duplicates = Joiner.on(", ").join(findDuplicates(mainParameters));
|
||||
checkArgument(duplicates.isEmpty(), "Duplicate domain arguments found: '%s'", duplicates);
|
||||
initMutatingEppToolCommand();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue