Skip to content

Commit

Permalink
Modified config service API response to return correct data type
Browse files Browse the repository at this point in the history
  • Loading branch information
arishta-dev committed Jan 3, 2025
1 parent dc326dc commit af4889c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/main/java/org/cbioportal/web/IndexPageController.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.springframework.web.bind.annotation.RequestMapping;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import static org.cbioportal.service.FrontendPropertiesServiceImpl.FrontendProperty;
Expand All @@ -48,9 +49,20 @@ public class IndexPageController {

private final ObjectMapper mapper = new ObjectMapper();

private Map<String, String> getFrontendProperties(HttpServletRequest request, Authentication authentication) {
private Map<String, Object> getFrontendProperties(HttpServletRequest request, Authentication authentication) {
String baseUrl = requestUtils.getBaseUrl(request);
Map<String, String> properties = frontendPropertiesService.getFrontendProperties();
Map<String, Object> properties = new HashMap<>();

Map<String, String> originalProperties = frontendPropertiesService.getFrontendProperties();

for (Map.Entry<String, String> entry : originalProperties.entrySet()) {
String value = entry.getValue();
if (value!=null && (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("false"))) {
properties.put(entry.getKey(), Boolean.valueOf(value));
} else {
properties.put(entry.getKey(), value);
}
}
properties.put("base_url", baseUrl);
properties.put("user_email_address", authentication != null ? authentication.getName(): "anonymousUser");
// TODO: Support skin.user_display_name
Expand Down

0 comments on commit af4889c

Please sign in to comment.