Make the superuser flag bypass TLD access checks

The --superuser command in the nomulus command-line tool should be
bypassing checks on whether the passed-in registrar client ID has access
to the TLD in question, but currently it is not.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=158974462
This commit is contained in:
Ben McIlwain 2017-06-14 07:14:19 -07:00
parent 3a02e6fb11
commit 580c41f2d6
26 changed files with 223 additions and 38 deletions

View file

@ -31,7 +31,6 @@ import google.registry.model.domain.DomainResource;
import google.registry.model.registrar.Registrar;
import google.registry.model.registry.Registry;
import google.registry.model.registry.Registry.TldState;
import google.registry.testing.DatastoreHelper;
import org.junit.Before;
import org.junit.Test;
@ -81,7 +80,6 @@ public class ClaimsCheckFlowTest extends ResourceFlowTestCase<ClaimsCheckFlow, D
doSuccessfulTest("domain_check_claims_response.xml");
}
@Test
public void testSuccess_multipleTlds() throws Exception {
setEppInput("domain_check_claims_multiple_tlds.xml");
@ -115,7 +113,7 @@ public class ClaimsCheckFlowTest extends ResourceFlowTestCase<ClaimsCheckFlow, D
@Test
public void testFailure_notAuthorizedForTld() throws Exception {
DatastoreHelper.persistResource(
persistResource(
Registrar.loadByClientId("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
@ -124,6 +122,22 @@ public class ClaimsCheckFlowTest extends ResourceFlowTestCase<ClaimsCheckFlow, D
runFlow();
}
@Test
public void testSuccess_superuserNotAuthorizedForTld() throws Exception {
persistClaimsList(
ImmutableMap.of("example2", "2013041500/2/6/9/rJ1NrDO92vDsAzf7EQzgjX4R0000000001"));
persistResource(
Registrar.loadByClientId("TheRegistrar")
.asBuilder()
.setAllowedTlds(ImmutableSet.<String>of())
.build());
assertTransactionalFlow(false);
assertNoHistory(); // Checks don't create a history event.
assertNoBillingEvents(); // Checks are always free.
runFlowAssertResponse(
CommitMode.LIVE, UserPrivileges.SUPERUSER, readFile("domain_check_claims_response.xml"));
}
@Test
public void testFailure_predelgation() throws Exception {
createTld("tld", TldState.PREDELEGATION);