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:
parent
9bd5a500e2
commit
d0a42181bf
1 changed files with 31 additions and 2 deletions
|
@ -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.DefaultInconclusivePolicy;
|
||||
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.ifaces.RequestedAction;
|
||||
|
||||
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
|
||||
public PolicyDecision isAuthorized(IdentifierBundle whoToAuth,
|
||||
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 */
|
||||
/* see issue NIHVIVO-739 */
|
||||
if( AUTHORSHIP.equals( dops.getUriOfPredicate() )) {
|
||||
if( AUTHORSHIP_FROM_PUB.equals( dops.getUriOfPredicate() )) {
|
||||
return new BasicPolicyDecision(Authorization.UNAUTHORIZED,
|
||||
"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);
|
||||
|
|
Loading…
Add table
Reference in a new issue