Add log statements and toString() methods to help in debugging.
This commit is contained in:
parent
fff0167211
commit
1162a294c1
3 changed files with 24 additions and 0 deletions
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.auth.policy;
|
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.IdentifierBundle;
|
import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle;
|
||||||
import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.HasPermission;
|
import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.HasPermission;
|
||||||
import edu.cornell.mannlib.vitro.webapp.auth.permissions.Permission;
|
import edu.cornell.mannlib.vitro.webapp.auth.permissions.Permission;
|
||||||
|
@ -15,6 +18,7 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAct
|
||||||
* Permissions will authorize it.
|
* Permissions will authorize it.
|
||||||
*/
|
*/
|
||||||
public class PermissionsPolicy implements PolicyIface {
|
public class PermissionsPolicy implements PolicyIface {
|
||||||
|
private static final Log log = LogFactory.getLog(PermissionsPolicy.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PolicyDecision isAuthorized(IdentifierBundle whoToAuth,
|
public PolicyDecision isAuthorized(IdentifierBundle whoToAuth,
|
||||||
|
@ -28,10 +32,12 @@ public class PermissionsPolicy implements PolicyIface {
|
||||||
|
|
||||||
for (Permission p : HasPermission.getPermissions(whoToAuth)) {
|
for (Permission p : HasPermission.getPermissions(whoToAuth)) {
|
||||||
if (p.isAuthorized(whatToAuth)) {
|
if (p.isAuthorized(whatToAuth)) {
|
||||||
|
log.debug("Permission " + p + " approves request " + whatToAuth);
|
||||||
return new BasicPolicyDecision(Authorization.AUTHORIZED,
|
return new BasicPolicyDecision(Authorization.AUTHORIZED,
|
||||||
"PermissionsPolicy: approved by " + p);
|
"PermissionsPolicy: approved by " + p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.debug("No permission will approve " + whatToAuth);
|
||||||
return defaultDecision("no permission will approve " + whatToAuth);
|
return defaultDecision("no permission will approve " + whatToAuth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,4 +17,13 @@ public class DisplayDataPropertyStatement extends RequestedAction {
|
||||||
public DataPropertyStatement getDataPropertyStatement() {
|
public DataPropertyStatement getDataPropertyStatement() {
|
||||||
return dataPropertyStatement;
|
return dataPropertyStatement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "DisplayDataPropertyStatement["
|
||||||
|
+ dataPropertyStatement.getIndividualURI() + "==>"
|
||||||
|
+ dataPropertyStatement.getDatapropURI() + "==>"
|
||||||
|
+ dataPropertyStatement.getData() + "]";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,4 +17,13 @@ public class DisplayObjectPropertyStatement extends RequestedAction {
|
||||||
public ObjectPropertyStatement getObjectPropertyStatement() {
|
public ObjectPropertyStatement getObjectPropertyStatement() {
|
||||||
return objectPropertyStatement;
|
return objectPropertyStatement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "DisplayObjectPropertyStatement["
|
||||||
|
+ objectPropertyStatement.getSubjectURI() + "==>"
|
||||||
|
+ objectPropertyStatement.getPropertyURI() + "==>"
|
||||||
|
+ objectPropertyStatement.getObjectURI() + "]";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue