author and publication links cannot be deleted from the authorship node

authorship node will not offer an add link for author or pub 
NIHVIVO-739
This commit is contained in:
bdc34 2010-07-14 15:56:38 +00:00
parent 9bd5a500e2
commit d0a42181bf

View file

@ -6,12 +6,14 @@ 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.Authorization;
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.DefaultInconclusivePolicy; 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.policy.ifaces.PolicyDecision;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AddObjectPropStmt;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.DropObjectPropStmt; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.DropObjectPropStmt;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction;
public class VivoPolicy extends DefaultInconclusivePolicy{ public class VivoPolicy extends DefaultInconclusivePolicy{
private static String AUTHORSHIP = "http://vivoweb.org/ontology/core#informationResourceInAuthorship"; private static String AUTHORSHIP_FROM_PUB = "http://vivoweb.org/ontology/core#informationResourceInAuthorship";
private static String AUTHORSHIP_FROM_PERSON = "http://vivoweb.org/ontology/core#authorInAuthorship";
@Override @Override
public PolicyDecision isAuthorized(IdentifierBundle whoToAuth, public PolicyDecision isAuthorized(IdentifierBundle whoToAuth,
RequestedAction whatToAuth) { RequestedAction whatToAuth) {
@ -21,10 +23,37 @@ public class VivoPolicy extends DefaultInconclusivePolicy{
/* Do not offer the user the option to delete so they will use the custom form instead */ /* Do not offer the user the option to delete so they will use the custom form instead */
/* see issue NIHVIVO-739 */ /* see issue NIHVIVO-739 */
if( AUTHORSHIP.equals( dops.getUriOfPredicate() )) { if( AUTHORSHIP_FROM_PUB.equals( dops.getUriOfPredicate() )) {
return new BasicPolicyDecision(Authorization.UNAUTHORIZED, return new BasicPolicyDecision(Authorization.UNAUTHORIZED,
"Use the custom edit form for core:informationResourceInAuthorship"); "Use the custom edit form for core:informationResourceInAuthorship");
} }
if( AUTHORSHIP_FROM_PERSON.equals( dops.getUriOfPredicate() )) {
return new BasicPolicyDecision(Authorization.UNAUTHORIZED,
"Use the custom edit form for core:authorInAuthorship");
}
if( "http://vivoweb.org/ontology/core#linkedAuthor".equals( dops.getUriOfPredicate())){
return new BasicPolicyDecision(Authorization.UNAUTHORIZED,
"Use the custom edit form for on information resource to edit authors.");
}
if( "http://vivoweb.org/ontology/core#linkedInformationResource".equals( dops.getUriOfPredicate())){
return new BasicPolicyDecision(Authorization.UNAUTHORIZED,
"Use the custom edit form for on information resource to edit authors.");
}
}
if( whatToAuth instanceof AddObjectPropStmt ){
AddObjectPropStmt aops = (AddObjectPropStmt)whatToAuth;
if( "http://vivoweb.org/ontology/core#linkedAuthor".equals( aops.getUriOfPredicate())){
return new BasicPolicyDecision(Authorization.UNAUTHORIZED,
"Use the custom edit form for on information resource to edit authors.");
}
if( "http://vivoweb.org/ontology/core#linkedInformationResource".equals( aops.getUriOfPredicate())){
return new BasicPolicyDecision(Authorization.UNAUTHORIZED,
"Use the custom edit form for on information resource to edit authors.");
}
} }
return super.isAuthorized(whoToAuth, whatToAuth); return super.isAuthorized(whoToAuth, whatToAuth);