NIHVIVO-2299 Improve the code in the common family of Identifiers.
This commit is contained in:
parent
8db9f1dd87
commit
491f5d3728
2 changed files with 4 additions and 22 deletions
|
@ -2,14 +2,8 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.auth.policy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
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.SelfEditingIdentifierFactory.SelfEditing;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.policy.bean.PropertyRestrictionPolicyHelper;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision;
|
||||
|
@ -37,21 +31,6 @@ public abstract class BaseSelfEditingPolicy {
|
|||
uri, roleLevel);
|
||||
}
|
||||
|
||||
protected List<String> getUrisOfSelfEditor(IdentifierBundle ids) {
|
||||
List<String> uris = new ArrayList<String>();
|
||||
if (ids != null) {
|
||||
for (Identifier id : ids) {
|
||||
if (id instanceof SelfEditing) {
|
||||
SelfEditing selfEditId = (SelfEditing) id;
|
||||
if (selfEditId.getBlacklisted() == null) {
|
||||
uris.add(selfEditId.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return uris;
|
||||
}
|
||||
|
||||
protected PolicyDecision cantModifyResource(String uri) {
|
||||
return inconclusiveDecision("No access to admin resources; cannot modify "
|
||||
+ uri);
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.auth.policy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.identifier.HasAssociatedIndividual;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyIface;
|
||||
|
@ -35,7 +37,8 @@ public class SelfEditingPolicy extends BaseSelfEditingPolicy implements
|
|||
return inconclusiveDecision("whatToAuth was null");
|
||||
}
|
||||
|
||||
List<String> userUris = getUrisOfSelfEditor(whoToAuth);
|
||||
List<String> userUris = new ArrayList<String>(
|
||||
HasAssociatedIndividual.getIndividualUris(whoToAuth));
|
||||
|
||||
if (userUris.isEmpty()) {
|
||||
return inconclusiveDecision("Not self-editing.");
|
||||
|
|
Loading…
Add table
Reference in a new issue