[VIVO-1670] ORCID - Disable Step 2 and Internationalization (#130)
* Internationalize ORCiD add an iD * ORCID Internationalization, allow Step 2 to be disabled if only a public API key Resolves: https://jira.duraspace.org/browse/VIVO-1670
This commit is contained in:
parent
06d266ea94
commit
d3b377b3a7
6 changed files with 108 additions and 56 deletions
|
@ -13,6 +13,7 @@ import javax.servlet.ServletContext;
|
|||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
|
||||
import edu.cornell.mannlib.vivo.orcid.controller.OrcidAbstractHandler;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
@ -54,6 +55,10 @@ public class OrcidContextSetup implements ServletContextListener {
|
|||
private void initializeOrcidClientContext(ConfigurationProperties props,
|
||||
StartupStatus ss) {
|
||||
try {
|
||||
if (!"member".equalsIgnoreCase(props.getProperty("orcid.apiLevel", "member"))) {
|
||||
OrcidAbstractHandler.setAPiLevelPublic();
|
||||
}
|
||||
|
||||
Map<Setting, String> settings = new EnumMap<>(Setting.class);
|
||||
settings.put(CLIENT_ID, props.getProperty("orcid.clientId"));
|
||||
settings.put(CLIENT_SECRET,
|
||||
|
|
|
@ -45,6 +45,8 @@ public abstract class OrcidAbstractHandler {
|
|||
protected final OrcidConfirmationState state;
|
||||
protected final UserAccount currentUser;
|
||||
|
||||
private static String apiLevel = "member";
|
||||
|
||||
protected OrcidAbstractHandler(VitroRequest vreq) {
|
||||
this.vreq = vreq;
|
||||
this.occ = OrcidClientContext.getInstance();
|
||||
|
@ -121,7 +123,12 @@ public abstract class OrcidAbstractHandler {
|
|||
protected ResponseValues showConfirmationPage() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("orcidInfo", state.toMap());
|
||||
map.put("orcidApiLevel", apiLevel);
|
||||
return new TemplateResponseValues(TEMPLATE_CONFIRM, map);
|
||||
}
|
||||
|
||||
public static void setAPiLevelPublic() {
|
||||
apiLevel = "public";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue