Pass name/email/phone info to the new console front end (#2180)

This commit is contained in:
gbrodman 2023-10-16 16:51:35 -04:00 committed by GitHub
parent 4f53ae0e89
commit 779da518df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 49 additions and 13 deletions

View file

@ -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));

View file

@ -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");
}
}