public boolean isAuthorizedForRequestedAction(RequestedAction action) { PolicyIface policy = getPolicies(); PolicyDecision dec = policy.isAuthorized(getIdentifiers(), action); if (dec != null && dec.getAuthorized() == Authorization.AUTHORIZED) { log.debug("Authorized because self-editing."); return true; } else { log.debug( "Not Authorized even though self-editing: " + ((dec == null) ? "null" : dec.getMessage() + ", " + dec.getDebuggingInfo())); return false; } }
private void assertDecision(Authorization expected, PolicyDecision decision) { log.debug("Decision is: " + decision); assertNotNull("decision exists", decision); assertEquals("authorization", expected, decision.getAuthorized()); }