-
- |
- |
---|---|
- |
-
-
-
- |
-
- |
-
+
+ |
+ |
---|---|
+ |
+
+
+
+ |
+
+ |
+
-
- Example Policy
- PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX vivoa: <http://vivo.library.cornell.edu/abox#>
-PREFIX vivo: <http://vivo.library.cornell.edu/ns/0.1#>
-PREFIX vitro: <http://lowe.mannlib.cornell.edu/ns/vitro/0.1/vitro.owl#>
-
-
-
- edu.cornell.mannlib.vitro.webapp.auth.requestedAction.DropDataPropStmt
-
- ASK WHERE { ?subject vitro:netid ?netid }
- ASK WHERE { ?object vitro:netid ?netid }
-
-
-
- edu.cornell.mannlib.vitro.webapp.auth.requestedAction.DropObjectPropStmt
-
- ASK WHERE { ?subject vitro:netid ?netid }
- ASK WHERE { ?object vitro:netid ?netid }
-
-
-
- edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AddObjectPropStmt
-
- ASK WHERE { ?subject vitro:netid ?netid }
- ASK WHERE { ?object vitro:netid ?netid }
-
-
-
- edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AddDataPropStmt
-
- ASK WHERE { ?subject vitro:netid ?netid }
- ASK WHERE { ?object vitro:netid ?netid }
-
-
-
-
-
-
- * @author bdc34
- *
- */
-public class JenaNetidPolicy extends DefaultInconclusivePolicy implements PolicyIface {
-
-
- protected transient Model model = ModelFactory.createDefaultModel();
- private transient HashMap
-
-
- Example Policy
- PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX vivoa: <http://vivo.library.cornell.edu/abox#>
-PREFIX vivo: <http://vivo.library.cornell.edu/ns/0.1#>
-PREFIX vitro: <http://lowe.mannlib.cornell.edu/ns/vitro/0.1/vitro.owl#>
-
-
-
- edu.cornell.mannlib.vitro.webapp.auth.requestedAction.DropDataPropStmt
-
- ASK WHERE { ?subject vitro:netid ?netid }
- ASK WHERE { ?object vitro:netid ?netid }
-
-
-
- edu.cornell.mannlib.vitro.webapp.auth.requestedAction.DropObjectPropStmt
-
- ASK WHERE { ?subject vitro:netid ?netid }
- ASK WHERE { ?object vitro:netid ?netid }
-
-
-
- edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AddObjectPropStmt
-
- ASK WHERE { ?subject vitro:netid ?netid }
- ASK WHERE { ?object vitro:netid ?netid }
-
-
-
- edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AddDataPropStmt
-
- ASK WHERE { ?subject vitro:netid ?netid }
- ASK WHERE { ?object vitro:netid ?netid }
-
-
-
-
-
-
- */
-}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/SparqlPolicyDecision.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/SparqlPolicyDecision.java
deleted file mode 100644
index 05abf69b2..000000000
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/SparqlPolicyDecision.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/* $This file is distributed under the terms of the license in /doc/license.txt$ */
-
-package edu.cornell.mannlib.vitro.webapp.auth.policy;
-
-import com.hp.hpl.jena.query.Query;
-import com.hp.hpl.jena.query.QueryExecution;
-
-import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization;
-
-/**
- * Extends the BasicPolicyDecision with additional debugging information about the
- * sparql queries that were run to create the decision.
- *
- * @author bdc34
- *
- */
-public class SparqlPolicyDecision extends BasicPolicyDecision {
- Query query = null;
- QueryExecution qexec = null;
-
- public SparqlPolicyDecision(Authorization authorized, String message) {
- super(authorized, message);
- }
-
- public QueryExecution getQexec() {
- return qexec;
- }
-
- public void setQexec(QueryExecution qexec) {
- this.qexec = qexec;
- }
-
- public Query getQuery() {
- return query;
- }
-
- public void setQuery(Query query) {
- this.query = query;
- }
-
- @Override
- public String getDebuggingInfo() {
- String msg = "";
- if( super.getDebuggingInfo() != null && super.getDebuggingInfo().length() > 0)
- msg = super.getDebuggingInfo() + '\n';
-
- if( query != null )
- msg= msg + "query: \n" + query.toString() + '\n';
- else
- msg = msg + " query was null \n";
-
- if( qexec != null )
- msg = msg + "query exec: \n" + qexec.toString();
- else
- msg = msg + " query exec was null \n";
-
- return msg;
- }
-
-
-}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/UseRestrictedPagesByRoleLevelPolicy.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/UseRestrictedPagesByRoleLevelPolicy.java
index 09ca36896..e7cb90667 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/UseRestrictedPagesByRoleLevelPolicy.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/UseRestrictedPagesByRoleLevelPolicy.java
@@ -5,9 +5,8 @@ package edu.cornell.mannlib.vitro.webapp.auth.policy;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import edu.cornell.mannlib.vitro.webapp.auth.identifier.HasRoleLevel;
-import edu.cornell.mannlib.vitro.webapp.auth.identifier.Identifier;
import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle;
+import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.HasRoleLevel;
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization;
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision;
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyIface;
@@ -27,6 +26,7 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseAdvance
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseBasicAjaxControllers;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseMiscellaneousAdminPages;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseMiscellaneousCuratorPages;
+import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseMiscellaneousEditorPages;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.UseMiscellaneousPages;
import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel;
@@ -48,7 +48,7 @@ public class UseRestrictedPagesByRoleLevelPolicy implements PolicyIface {
return defaultDecision("whatToAuth was null");
}
- RoleLevel userRole = getUsersRoleLevel(whoToAuth);
+ RoleLevel userRole = HasRoleLevel.getUsersRoleLevel(whoToAuth);
PolicyDecision result;
if (whatToAuth instanceof UseAdvancedDataToolsPages) {
@@ -93,6 +93,9 @@ public class UseRestrictedPagesByRoleLevelPolicy implements PolicyIface {
} else if (whatToAuth instanceof SeeIndividualEditingPanel) {
result = isAuthorized(whatToAuth, RoleLevel.EDITOR, userRole);
+ } else if (whatToAuth instanceof UseMiscellaneousEditorPages) {
+ result = isAuthorized(whatToAuth, RoleLevel.EDITOR, userRole);
+
} else if (whatToAuth instanceof UseBasicAjaxControllers) {
result = isAuthorized(whatToAuth, RoleLevel.SELF, userRole);
@@ -137,16 +140,4 @@ public class UseRestrictedPagesByRoleLevelPolicy implements PolicyIface {
return new BasicPolicyDecision(Authorization.INCONCLUSIVE, message);
}
- /**
- * The user is nobody unless they have a HasRoleLevel identifier.
- */
- private RoleLevel getUsersRoleLevel(IdentifierBundle whoToAuth) {
- RoleLevel userRole = RoleLevel.PUBLIC;
- for (Identifier id : whoToAuth) {
- if (id instanceof HasRoleLevel) {
- userRole = ((HasRoleLevel) id).getRoleLevel();
- }
- }
- return userRole;
- }
}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/CommonPolicyFamilySetup.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/CommonPolicyFamilySetup.java
index 94f0623f3..2fca2f1ee 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/CommonPolicyFamilySetup.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/CommonPolicyFamilySetup.java
@@ -10,7 +10,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.auth.identifier.ActiveIdentifierBundleFactories;
-import edu.cornell.mannlib.vitro.webapp.auth.identifier.CommonIdentifierBundleFactory;
+import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.CommonIdentifierBundleFactory;
import edu.cornell.mannlib.vitro.webapp.auth.policy.DisplayRestrictedDataByRoleLevelPolicy;
import edu.cornell.mannlib.vitro.webapp.auth.policy.DisplayRestrictedDataToSelfPolicy;
import edu.cornell.mannlib.vitro.webapp.auth.policy.ServletPolicyList;
@@ -41,7 +41,7 @@ public class CommonPolicyFamilySetup implements ServletContextListener {
new UseRestrictedPagesByRoleLevelPolicy());
// This factory creates Identifiers for all of the above policies.
- CommonIdentifierBundleFactory factory = new CommonIdentifierBundleFactory();
+ CommonIdentifierBundleFactory factory = new CommonIdentifierBundleFactory(ctx);
ActiveIdentifierBundleFactories.addFactory(sce, factory);
} catch (Exception e) {
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/JenaNetidPolicySetup.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/JenaNetidPolicySetup.java
deleted file mode 100644
index 29810e6de..000000000
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/JenaNetidPolicySetup.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $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 com.hp.hpl.jena.ontology.OntModel;
-
-import edu.cornell.mannlib.vitro.webapp.auth.identifier.ActiveIdentifierBundleFactories;
-import edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditingIdentifierFactory;
-import edu.cornell.mannlib.vitro.webapp.auth.policy.JenaNetidPolicy;
-import edu.cornell.mannlib.vitro.webapp.auth.policy.ServletPolicyList;
-
-/**
- * Class used to setup a JenaNetidPolicy using the default.
- * This setups the JenaNetidPolicy and a SelfEditingIdentifierFactory.
- *
- * See JenaNetidPolicy.setupDefault() for the sparql queries that will
- * be used by the default JenaNetidPolicy.
- *
- * @author bdc34
- *
- */
-public class JenaNetidPolicySetup implements ServletContextListener {
-
- private static final Log log = LogFactory.getLog(JenaNetidPolicySetup.class.getName());
-
- @Override
- public void contextInitialized(ServletContextEvent sce) {
- try{
- log.debug("Setting up JenaNetidPolicy");
-
- JenaNetidPolicy jnip = new JenaNetidPolicy((OntModel) sce.getServletContext().getAttribute("jenaOntModel"));
- ServletPolicyList.addPolicy(sce.getServletContext(), jnip);
-
- SelfEditingIdentifierFactory niif =new SelfEditingIdentifierFactory();
- ActiveIdentifierBundleFactories.addFactory(sce, niif);
-
- }catch(Exception e){
- log.error("could not create AuthorizationFactory: " + e);
- e.printStackTrace();
- }
- }
-
- @Override
- public void contextDestroyed(ServletContextEvent sce) {
- /*nothing*/
- }
-
-}
-
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/SelfEditing2RoleIdentifierSetup.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/SelfEditing2RoleIdentifierSetup.java
deleted file mode 100644
index 001aa5608..000000000
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/setup/SelfEditing2RoleIdentifierSetup.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/* $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.identifier.ActiveIdentifierBundleFactories;
-import edu.cornell.mannlib.vitro.webapp.auth.identifier.SelfEditing2RoleIdentifierFactory;
-
-/**
- * Add the SelfEditing2RoleIdentifier factory to the IdentifierFactory list
- * in the servlet context.
- *
- * This should be added to the IdentifierFactory list after the
- * SelfEditingIdentiferFactory.
- *
- * This only sets up a IdentifierFactoy that maps SelfEditing identifiers to
- * roles associated with the Individual that represents the self editor. This
- * does not set up a policy or the SelfEditingIdentifierFactory.
- *
- * @author bdc34
- *
- */
-public class SelfEditing2RoleIdentifierSetup implements ServletContextListener{
-
- private static final Log log = LogFactory.getLog(SelfEditing2RoleIdentifierSetup.class.getName());
-
- @Override
- public void contextDestroyed(ServletContextEvent sce) {
- //do nothing
- }
-
- @Override
- public void contextInitialized(ServletContextEvent sce) {
- try{
- log.debug("Setting up SelfEditing2RoleIdentifier");
- ActiveIdentifierBundleFactories.addFactory(sce, new SelfEditing2RoleIdentifierFactory());
- log.debug( "SelfEditing2RoleIdentifier has been setup. " );
- }catch(Exception e){
- log.error("could not run SelfEditing2RoleIdentifier: " + e);
- e.printStackTrace();
- }
- }
-
-}
diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/specialrelationships/AbstractRelationshipPolicy.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/specialrelationships/AbstractRelationshipPolicy.java
index 0fb8e1928..c238d246c 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/specialrelationships/AbstractRelationshipPolicy.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/specialrelationships/AbstractRelationshipPolicy.java
@@ -19,9 +19,6 @@ import com.hp.hpl.jena.rdf.model.SimpleSelector;
import com.hp.hpl.jena.rdf.model.StmtIterator;
import com.hp.hpl.jena.shared.Lock;
-import edu.cornell.mannlib.vitro.webapp.auth.identifier.HasAssociatedIndividual;
-import edu.cornell.mannlib.vitro.webapp.auth.identifier.Identifier;
-import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle;
import edu.cornell.mannlib.vitro.webapp.auth.policy.BasicPolicyDecision;
import edu.cornell.mannlib.vitro.webapp.auth.policy.bean.PropertyRestrictionPolicyHelper;
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization;
@@ -47,24 +44,6 @@ public abstract class AbstractRelationshipPolicy implements PolicyIface {
this.model = model;
}
- /**
- * Check to see whether we are self-editing, and for which Individuals.
- */
- protected List