mirror of
https://github.com/google/nomulus
synced 2026-02-06 13:01:11 +00:00
Pass name/email/phone info to the new console front end (#2180)
This commit is contained in:
@@ -40,15 +40,24 @@ public class ConsoleUserDataAction implements JsonGetAction {
|
||||
|
||||
private final AuthResult authResult;
|
||||
private final Response response;
|
||||
private final String productName;
|
||||
private final String supportPhoneNumber;
|
||||
private final String supportEmail;
|
||||
private final String technicalDocsUrl;
|
||||
|
||||
@Inject
|
||||
public ConsoleUserDataAction(
|
||||
AuthResult authResult,
|
||||
Response response,
|
||||
@Config("productName") String productName,
|
||||
@Config("supportEmail") String supportEmail,
|
||||
@Config("supportPhoneNumber") String supportPhoneNumber,
|
||||
@Config("technicalDocsUrl") String technicalDocsUrl) {
|
||||
this.response = response;
|
||||
this.authResult = authResult;
|
||||
this.productName = productName;
|
||||
this.supportEmail = supportEmail;
|
||||
this.supportPhoneNumber = supportPhoneNumber;
|
||||
this.technicalDocsUrl = technicalDocsUrl;
|
||||
}
|
||||
|
||||
@@ -74,6 +83,10 @@ public class ConsoleUserDataAction implements JsonGetAction {
|
||||
// auth checks.
|
||||
"isAdmin", user.getUserRoles().isAdmin(),
|
||||
"globalRole", user.getUserRoles().getGlobalRole(),
|
||||
// Include static contact resources in this call to minimize round trips
|
||||
"productName", productName,
|
||||
"supportEmail", supportEmail,
|
||||
"supportPhoneNumber", supportPhoneNumber,
|
||||
// Is used by UI to construct a link to registry resources
|
||||
"technicalDocsUrl", technicalDocsUrl));
|
||||
|
||||
|
||||
@@ -54,7 +54,19 @@ class ConsoleUserDataActionTest {
|
||||
assertThat(response.getStatus()).isEqualTo(HttpStatusCodes.STATUS_CODE_OK);
|
||||
Map jsonObject = GSON.fromJson(response.getPayload(), Map.class);
|
||||
assertThat(jsonObject)
|
||||
.containsExactly("isAdmin", false, "technicalDocsUrl", "test", "globalRole", "FTE");
|
||||
.containsExactly(
|
||||
"isAdmin",
|
||||
false,
|
||||
"technicalDocsUrl",
|
||||
"test",
|
||||
"globalRole",
|
||||
"FTE",
|
||||
"productName",
|
||||
"Nomulus",
|
||||
"supportPhoneNumber",
|
||||
"+1 (212) 867 5309",
|
||||
"supportEmail",
|
||||
"support@example.com");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -71,6 +83,7 @@ class ConsoleUserDataActionTest {
|
||||
}
|
||||
|
||||
private ConsoleUserDataAction createAction(AuthResult authResult) throws IOException {
|
||||
return new ConsoleUserDataAction(authResult, response, "test");
|
||||
return new ConsoleUserDataAction(
|
||||
authResult, response, "Nomulus", "support@example.com", "+1 (212) 867 5309", "test");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user