[Trunk | Admin Tools Library]:
1. AdminToolsLibraryCheckDeployController.java: a. In "hello()" method added @RequestMapping (except for existing ""), "/health_check". b. Added method "checkEverything()" (/health_chech/advanced) only accessible by PORTAL ADMINS which checks connection with db and prints properties. 2. PortalPage.java: Added default value "false" for position fields (top, bottom, left, right).
This commit is contained in:
parent
9c57010ca3
commit
62cb461196
|
@ -1,21 +1,54 @@
|
|||
package eu.dnetlib.uoaadmintoolslibrary.controllers;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.CommandResult;
|
||||
import com.mongodb.DBObject;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.configuration.properties.GoogleConfig;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.configuration.properties.MailConfig;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin(origins = "*")
|
||||
@RequestMapping("/admin-tools-library")
|
||||
public class AdminToolsLibraryCheckDeployController {
|
||||
@Autowired
|
||||
private MailConfig mailConfig;
|
||||
|
||||
@Autowired
|
||||
private GoogleConfig googleConfig;
|
||||
|
||||
private final Logger log = Logger.getLogger(this.getClass());
|
||||
|
||||
@RequestMapping(value = "", method = RequestMethod.GET)
|
||||
@RequestMapping(value = {"", "/health_check"}, method = RequestMethod.GET)
|
||||
public String hello() {
|
||||
log.debug("Hello from uoa-admin-tools-library!");
|
||||
return "Hello from uoa-admin-tools-library!";
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAnyAuthority(@AuthorizationService.PORTAL_ADMIN)")
|
||||
@RequestMapping(value = "/health_check/advanced", method = RequestMethod.GET)
|
||||
public Map<String, String> checkEverything() {
|
||||
Map<String, String> response = new HashMap<>();
|
||||
response.put("admintoolslibrary.mail.auth",mailConfig.getAuth());
|
||||
response.put("admintoolslibrary.mail.from", mailConfig.getAuth());
|
||||
response.put("admintoolslibrary.mail.host", mailConfig.getHost());
|
||||
response.put("admintoolslibrary.mail.port", mailConfig.getPort());
|
||||
response.put("admintoolslibrary.mail.username", mailConfig.getUsername() == null ? null : "[unexposed value]");
|
||||
response.put("admintoolslibrary.mail.password", mailConfig.getPassword() == null ? null : "[unexposed value]");
|
||||
response.put("admintoolslibrary.google.secret", googleConfig.getSecret() == null ? null : "[unexposed value]");
|
||||
|
||||
// response.put("Define also", "admintoolslibrary.mail.username, " +
|
||||
// "admintoolslibrary.mail.password, admintoolslibrary.google.secret");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,10 +27,10 @@ public class PortalPage {
|
|||
// private Boolean openaire;
|
||||
|
||||
// Posiitions where help texts are allowed for this page
|
||||
private Boolean top;
|
||||
private Boolean bottom;
|
||||
private Boolean left;
|
||||
private Boolean right;
|
||||
private Boolean top = false;
|
||||
private Boolean bottom = false;
|
||||
private Boolean left = false;
|
||||
private Boolean right = false;
|
||||
|
||||
public PortalPage() {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue