Add Registry Lock UI (#369)
* Add Registry Lock UI * Responses to CRs, mostly TODO: - Figure out wording for the 'not enabled yet' message - Include the server status change cost in the email, or in the UI? - Should we show non-completed lock requests in the UI? * Fix get action test * Change the not-allowed-for-registrar msg to include support email * Change the wording on the price * Move TLD input into the modal, and other changes - don't log the password - test to make sure the password shows bullets * Responses to CR and cleanup * Format closer to something proper
|
@ -15,6 +15,7 @@
|
|||
package google.registry.ui.server.registrar;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.request.auth.AuthenticatedRegistrarAccessor.Role.ADMIN;
|
||||
import static google.registry.request.auth.AuthenticatedRegistrarAccessor.Role.OWNER;
|
||||
import static google.registry.testing.AppEngineRule.makeRegistrar2;
|
||||
import static google.registry.testing.AppEngineRule.makeRegistrarContact3;
|
||||
|
@ -156,11 +157,13 @@ public final class RegistryLockGetActionTest {
|
|||
ImmutableMap.of(
|
||||
"fullyQualifiedDomainName", "example.test",
|
||||
"lockedTime", "2000-06-08T22:00:00.000Z",
|
||||
"lockedBy", "johndoe@theregistrar.com"),
|
||||
"lockedBy", "johndoe@theregistrar.com",
|
||||
"userCanUnlock", true),
|
||||
ImmutableMap.of(
|
||||
"fullyQualifiedDomainName", "adminexample.test",
|
||||
"lockedTime", "2000-06-08T22:00:00.001Z",
|
||||
"lockedBy", "admin")))));
|
||||
"lockedBy", "admin",
|
||||
"userCanUnlock", false)))));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -218,10 +221,15 @@ public final class RegistryLockGetActionTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_lockAllowedForAdmin() throws Exception {
|
||||
public void testSuccess_lockAllowedForAdmin() {
|
||||
// Locks are allowed for admins even when they're not enabled for the registrar
|
||||
persistResource(makeRegistrar2().asBuilder().setRegistryLockAllowed(false).build());
|
||||
authResult = AuthResult.create(AuthLevel.USER, UserAuthInfo.create(user, true));
|
||||
accessor =
|
||||
AuthenticatedRegistrarAccessor.createForTesting(
|
||||
ImmutableSetMultimap.of(
|
||||
"TheRegistrar", ADMIN,
|
||||
"NewRegistrar", OWNER));
|
||||
action =
|
||||
new RegistryLockGetAction(
|
||||
Method.GET, response, accessor, authResult, Optional.of("TheRegistrar"));
|
||||
|
|
|
@ -21,18 +21,22 @@ import static google.registry.testing.AppEngineRule.makeRegistrarContact2;
|
|||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainBase;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.googlecode.objectify.ObjectifyFilter;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.ofy.OfyFilter;
|
||||
import google.registry.model.registrar.Registrar.State;
|
||||
import google.registry.model.registry.RegistryLockDao;
|
||||
import google.registry.module.frontend.FrontendServlet;
|
||||
import google.registry.schema.domain.RegistryLock;
|
||||
import google.registry.server.RegistryTestServer;
|
||||
import google.registry.testing.AppEngineRule;
|
||||
import google.registry.testing.CertificateSamples;
|
||||
import java.util.UUID;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -51,10 +55,11 @@ public class RegistrarConsoleScreenshotTest extends WebDriverTestCase {
|
|||
route("/registrar", FrontendServlet.class),
|
||||
route("/registrar-ote-status", FrontendServlet.class),
|
||||
route("/registrar-settings", FrontendServlet.class),
|
||||
route("/registry-lock-get", FrontendServlet.class),
|
||||
route("/registry-lock-verify", FrontendServlet.class))
|
||||
.setFilters(ObjectifyFilter.class, OfyFilter.class)
|
||||
.setFixtures(BASIC)
|
||||
.setEmail("Marla.Singer@google.com")
|
||||
.setEmail("Marla.Singer@crr.com")
|
||||
.build();
|
||||
|
||||
@Test
|
||||
|
@ -407,4 +412,119 @@ public class RegistrarConsoleScreenshotTest extends WebDriverTestCase {
|
|||
driver.waitForElement(By.id("reg-content"));
|
||||
driver.diffPage("page");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registryLock_empty() throws Throwable {
|
||||
driver.get(server.getUrl("/registrar?clientId=TheRegistrar#registry-lock"));
|
||||
driver.waitForElement(By.tagName("h2"));
|
||||
driver.diffPage("page");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registryLock_notAllowed() throws Throwable {
|
||||
server.runInAppEngineEnvironment(
|
||||
() -> {
|
||||
persistResource(makeRegistrar2().asBuilder().setRegistryLockAllowed(false).build());
|
||||
return null;
|
||||
});
|
||||
driver.get(server.getUrl("/registrar?clientId=TheRegistrar#registry-lock"));
|
||||
driver.waitForElement(By.tagName("h2"));
|
||||
driver.diffPage("page");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registryLock_nonEmpty() throws Throwable {
|
||||
server.runInAppEngineEnvironment(
|
||||
() -> {
|
||||
saveRegistryLock();
|
||||
return null;
|
||||
});
|
||||
driver.get(server.getUrl("/registrar#registry-lock"));
|
||||
driver.waitForElement(By.tagName("h2"));
|
||||
driver.diffPage("page");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registryLock_nonEmpty_admin() throws Throwable {
|
||||
server.runInAppEngineEnvironment(
|
||||
() -> {
|
||||
createTld("tld");
|
||||
DomainBase domain = persistActiveDomain("example.tld");
|
||||
RegistryLockDao.save(createRegistryLock(domain).asBuilder().isSuperuser(true).build());
|
||||
DomainBase otherDomain = persistActiveDomain("otherexample.tld");
|
||||
RegistryLockDao.save(createRegistryLock(otherDomain));
|
||||
return null;
|
||||
});
|
||||
driver.get(server.getUrl("/registrar#registry-lock"));
|
||||
driver.waitForElement(By.tagName("h2"));
|
||||
driver.diffPage("page");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registryLock_unlockModal() throws Throwable {
|
||||
server.setIsAdmin(true);
|
||||
server.runInAppEngineEnvironment(
|
||||
() -> {
|
||||
saveRegistryLock();
|
||||
return null;
|
||||
});
|
||||
driver.get(server.getUrl("/registrar#registry-lock"));
|
||||
driver.waitForElement(By.tagName("h2"));
|
||||
driver.findElement(By.id("button-unlock-example.tld")).click();
|
||||
driver.waitForElement(By.className("modal-content"));
|
||||
driver.findElement(By.id("domain-lock-password")).sendKeys("password");
|
||||
driver.diffPage("page");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registryLock_lockModal() throws Throwable {
|
||||
server.setIsAdmin(true);
|
||||
server.runInAppEngineEnvironment(
|
||||
() -> {
|
||||
createTld("tld");
|
||||
persistActiveDomain("example.tld");
|
||||
return null;
|
||||
});
|
||||
driver.get(server.getUrl("/registrar#registry-lock"));
|
||||
driver.waitForElement(By.tagName("h2"));
|
||||
driver.findElement(By.id("button-lock-domain")).click();
|
||||
driver.waitForElement(By.className("modal-content"));
|
||||
driver.findElement(By.id("domain-lock-input-value")).sendKeys("somedomain.tld");
|
||||
driver.findElement(By.id("domain-lock-password")).sendKeys("password");
|
||||
driver.diffPage("page");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registryLock_notAllowedForUser() throws Throwable {
|
||||
server.runInAppEngineEnvironment(
|
||||
() -> {
|
||||
persistResource(
|
||||
AppEngineRule.makeRegistrarContact3()
|
||||
.asBuilder()
|
||||
.setAllowedToSetRegistryLockPassword(true)
|
||||
.build());
|
||||
return null;
|
||||
});
|
||||
driver.get(server.getUrl("/registrar?clientId=TheRegistrar#registry-lock"));
|
||||
driver.waitForElement(By.tagName("h2"));
|
||||
driver.diffPage("page");
|
||||
}
|
||||
|
||||
private void saveRegistryLock() {
|
||||
createTld("tld");
|
||||
DomainBase domainBase = persistActiveDomain("example.tld");
|
||||
RegistryLockDao.save(createRegistryLock(domainBase));
|
||||
}
|
||||
|
||||
private RegistryLock createRegistryLock(DomainBase domainBase) {
|
||||
return new RegistryLock.Builder()
|
||||
.setVerificationCode(UUID.randomUUID().toString())
|
||||
.isSuperuser(false)
|
||||
.setRegistrarId("TheRegistrar")
|
||||
.setRegistrarPocId("Marla.Singer@crr.com")
|
||||
.setLockCompletionTimestamp(START_OF_TIME)
|
||||
.setDomainName("example.tld")
|
||||
.setRepoId(domainBase.getRepoId())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 90 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 91 KiB |
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 92 KiB |
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 199 KiB After Width: | Height: | Size: 200 KiB |
Before Width: | Height: | Size: 196 KiB After Width: | Height: | Size: 197 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 65 KiB |
Before Width: | Height: | Size: 141 KiB After Width: | Height: | Size: 142 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 56 KiB |