mirror of
https://github.com/google/nomulus.git
synced 2025-05-29 17:00:11 +02:00
Flat-map registry lock emails to avoid unclean errors in bad situations (#525)
* Flat map to avoid unclean errors in bad situations Also properly reflect that for admins, we will use their user email * Make MS's GAE user ID a public static field
This commit is contained in:
parent
f37b0bd915
commit
0b6a84b84c
5 changed files with 8 additions and 6 deletions
|
@ -159,9 +159,10 @@ public final class RegistryLockGetAction implements JsonGetAction {
|
|||
isAdmin || contactOptional.map(RegistrarContact::isRegistryLockAllowed).orElse(false);
|
||||
// Use the contact's registry lock email if it's present, else use the login email (for admins)
|
||||
String relevantEmail =
|
||||
contactOptional
|
||||
.map(contact -> contact.getRegistryLockEmailAddress().get())
|
||||
.orElse(user.getEmail());
|
||||
isAdmin
|
||||
? user.getEmail()
|
||||
// if the contact isn't present, we shouldn't display the email anyway so empty is fine
|
||||
: contactOptional.flatMap(RegistrarContact::getRegistryLockEmailAddress).orElse("");
|
||||
return ImmutableMap.of(
|
||||
LOCK_ENABLED_FOR_CONTACT_PARAM,
|
||||
isRegistryLockAllowed,
|
||||
|
|
|
@ -62,7 +62,7 @@ public final class RegistryTestServerMain {
|
|||
@Parameter(
|
||||
names = "--login_user_id",
|
||||
description = "GAE User ID for App Engine Local User Service.")
|
||||
private String loginUserId = AppEngineRule.THE_REGISTRAR_GAE_USER_ID;
|
||||
private String loginUserId = AppEngineRule.MARLA_SINGER_GAE_USER_ID;
|
||||
|
||||
@Parameter(
|
||||
names = "--login_is_admin",
|
||||
|
|
|
@ -71,6 +71,7 @@ public final class AppEngineRule extends ExternalResource {
|
|||
|
||||
public static final String NEW_REGISTRAR_GAE_USER_ID = "666";
|
||||
public static final String THE_REGISTRAR_GAE_USER_ID = "31337";
|
||||
public static final String MARLA_SINGER_GAE_USER_ID = "12345";
|
||||
|
||||
/**
|
||||
* The GAE testing library requires queue.xml to be a file, not a resource in a jar, so we read it
|
||||
|
@ -250,7 +251,7 @@ public final class AppEngineRule extends ExternalResource {
|
|||
.setRegistryLockEmailAddress("Marla.Singer.RegistryLock@crr.com")
|
||||
.setPhoneNumber("+1.2128675309")
|
||||
.setTypes(ImmutableSet.of(RegistrarContact.Type.TECH))
|
||||
.setGaeUserId("12345")
|
||||
.setGaeUserId(MARLA_SINGER_GAE_USER_ID)
|
||||
.setAllowedToSetRegistryLockPassword(true)
|
||||
.setRegistryLockPassword("hi")
|
||||
.build();
|
||||
|
|
|
@ -304,7 +304,7 @@ public final class RegistryLockGetActionTest {
|
|||
"lockEnabledForContact",
|
||||
true,
|
||||
"email",
|
||||
"Marla.Singer.RegistryLock@crr.com",
|
||||
"Marla.Singer@crr.com",
|
||||
"clientId",
|
||||
"TheRegistrar",
|
||||
"locks",
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 50 KiB |
Loading…
Add table
Add a link
Reference in a new issue