mirror of
https://github.com/google/nomulus.git
synced 2025-07-31 23:16:31 +02:00
Pass name/email/phone info to the new console front end (#2180)
This commit is contained in:
parent
4f53ae0e89
commit
779da518df
6 changed files with 49 additions and 13 deletions
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue