Hiding delete for core:authorInAuthorship NIHVIVO-739
Adding error message when Freemarker template system is not configured correctly in web.xml Adding principal investigator and co-pi role custom forms NIHVIVO-626
This commit is contained in:
parent
1a9e853a4d
commit
93b53a67c3
6 changed files with 81 additions and 7 deletions
|
@ -124,6 +124,10 @@
|
||||||
<listener-class> edu.cornell.mannlib.vitro.webapp.search.lucene.LuceneSetup </listener-class>
|
<listener-class> edu.cornell.mannlib.vitro.webapp.search.lucene.LuceneSetup </listener-class>
|
||||||
</listener>
|
</listener>
|
||||||
|
|
||||||
|
<listener>
|
||||||
|
<listener-class> edu.cornell.mannlib.vitro.webapp.auth.policy.setup.VivoPolicySetup</listener-class>
|
||||||
|
</listener>
|
||||||
|
|
||||||
<listener>
|
<listener>
|
||||||
<listener-class>
|
<listener-class>
|
||||||
edu.cornell.mannlib.vitro.webapp.auth.policy.setup.SelfEditingPolicySetup
|
edu.cornell.mannlib.vitro.webapp.auth.policy.setup.SelfEditingPolicySetup
|
||||||
|
@ -150,7 +154,7 @@
|
||||||
<listener-class> edu.cornell.mannlib.vitro.webapp.auth.policy.setup.DbAdminEditingPolicySetup
|
<listener-class> edu.cornell.mannlib.vitro.webapp.auth.policy.setup.DbAdminEditingPolicySetup
|
||||||
</listener-class>
|
</listener-class>
|
||||||
</listener>
|
</listener>
|
||||||
|
|
||||||
<listener>
|
<listener>
|
||||||
<listener-class>
|
<listener-class>
|
||||||
edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreeMarkerSetup
|
edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreeMarkerSetup
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.auth.policy;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.DefaultInconclusivePolicy;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.DropObjectPropStmt;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction;
|
||||||
|
|
||||||
|
public class VivoPolicy extends DefaultInconclusivePolicy{
|
||||||
|
|
||||||
|
private static String AUTHORSHIP = "http://vivoweb.org/ontology/core#informationResourceInAuthorship";
|
||||||
|
@Override
|
||||||
|
public PolicyDecision isAuthorized(IdentifierBundle whoToAuth,
|
||||||
|
RequestedAction whatToAuth) {
|
||||||
|
|
||||||
|
if( whatToAuth instanceof DropObjectPropStmt ){
|
||||||
|
DropObjectPropStmt dops = (DropObjectPropStmt)whatToAuth;
|
||||||
|
|
||||||
|
/* Do not offer the user the option to delete so they will use the custom form instead */
|
||||||
|
/* see issue NIHVIVO-739 */
|
||||||
|
if( AUTHORSHIP.equals( dops.getUriOfPredicate() )) {
|
||||||
|
return new BasicPolicyDecision(Authorization.UNAUTHORIZED,
|
||||||
|
"Use the custom edit form for core:informationResourceInAuthorship");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.isAuthorized(whoToAuth, whatToAuth);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -26,7 +26,7 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ontology.DefineObje
|
||||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ontology.RemoveOwlClass;
|
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ontology.RemoveOwlClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a policy where every type of action is authorized as INCONCLUSIVE
|
* A policy where every type of action is authorized as INCONCLUSIVE
|
||||||
* by default.
|
* by default.
|
||||||
*
|
*
|
||||||
* @author bdc34
|
* @author bdc34
|
||||||
|
@ -46,5 +46,5 @@ public class DefaultInconclusivePolicy implements PolicyIface{
|
||||||
}
|
}
|
||||||
protected static PolicyDecision INCONCLUSIVE_DECISION = new BasicPolicyDecision(
|
protected static PolicyDecision INCONCLUSIVE_DECISION = new BasicPolicyDecision(
|
||||||
Authorization.INCONCLUSIVE,
|
Authorization.INCONCLUSIVE,
|
||||||
"THis is the default decision defined in DefaultInconclusivePolicy");
|
"This is the default decision defined in DefaultInconclusivePolicy");
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.auth.policy.setup;
|
||||||
|
|
||||||
|
import javax.servlet.ServletContextEvent;
|
||||||
|
import javax.servlet.ServletContextListener;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.auth.policy.ServletPolicyList;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.auth.policy.VivoPolicy;
|
||||||
|
|
||||||
|
public class VivoPolicySetup implements ServletContextListener{
|
||||||
|
private static final Log log = LogFactory.getLog(VivoPolicySetup.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void contextInitialized(ServletContextEvent sce) {
|
||||||
|
log.debug("Setting up VivoPolicy");
|
||||||
|
|
||||||
|
//need to make a policy and add it to the ServeltContext
|
||||||
|
ServletPolicyList.addPolicy(sce.getServletContext(), new VivoPolicy());
|
||||||
|
|
||||||
|
//Note: The VivoPolicy doesn't use any identifier bundles so none are added here.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void contextDestroyed(ServletContextEvent arg0) {
|
||||||
|
//do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -105,6 +105,8 @@ public class FreeMarkerHttpServlet extends VitroHttpServlet {
|
||||||
// load templates from. Thus configurations are associated with themes rather than portals.
|
// load templates from. Thus configurations are associated with themes rather than portals.
|
||||||
Map<String, Configuration> themeToConfigMap = (Map<String, Configuration>) (getServletContext().getAttribute("themeToConfigMap"));
|
Map<String, Configuration> themeToConfigMap = (Map<String, Configuration>) (getServletContext().getAttribute("themeToConfigMap"));
|
||||||
|
|
||||||
|
if( themeToConfigMap == null )
|
||||||
|
log.error("The templating system is not configured correctly. Make sure that you have the FreeMarkerSetup context listener in your web.xml");
|
||||||
if (themeToConfigMap.containsKey(themeDir)) {
|
if (themeToConfigMap.containsKey(themeDir)) {
|
||||||
return themeToConfigMap.get(themeDir);
|
return themeToConfigMap.get(themeDir);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thread that executes the methods in IndexBuilder.
|
* Thread that executes the methods in IndexBuilder.
|
||||||
*
|
*
|
||||||
* @author bdc34
|
* @author bdc34
|
||||||
*
|
*
|
||||||
|
@ -36,9 +36,11 @@ public class IndexBuilderThread extends Thread{
|
||||||
log.debug("full re-index requested");
|
log.debug("full re-index requested");
|
||||||
indexBuilder.indexRebuild();
|
indexBuilder.indexRebuild();
|
||||||
}else{
|
}else{
|
||||||
log.debug("updated requested");
|
if( indexBuilder != null && indexBuilder.isThereWorkToDo() ){
|
||||||
Thread.sleep(250);
|
Thread.sleep(250); //wait a bit to let a bit more work to come into the queue
|
||||||
indexBuilder.updatedIndex();
|
log.debug("work found for IndexBuilder, starting update");
|
||||||
|
indexBuilder.updatedIndex();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}catch (Throwable e) {
|
}catch (Throwable e) {
|
||||||
log.error(e,e);
|
log.error(e,e);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue