@Test public void testPublishResults() { }
void publishResults() throws AccessDeniedException { if (LOG.isDebugEnabled()) { LOG.debug("==> AuthorizationSession.publishResults()"); } boolean authorized = isAuthorized(); if (_auditHandler != null) { List<AuthzAuditEvent> events = null; if (authorized) { List<AuthzAuditEvent> theseEvents = _auditHandler.getCapturedEvents(); if (theseEvents != null && !theseEvents.isEmpty()) { events = theseEvents; } } else { AuthzAuditEvent event = _auditHandler.getAndDiscardMostRecentEvent(); if (event != null) { events = Lists.newArrayList(event); } } if (LOG.isDebugEnabled()) { int size = events == null ? 0 : events.size(); String auditMessage = events == null ? "" : events.toString(); String message = String.format("Writing %d messages to audit: [%s]", size, auditMessage); LOG.debug(message); } _auditHandler.logAuthzAudits(events); } if (!authorized) { String reason = getDenialReason(); String message = getLogMessage(false, reason); if (LOG.isDebugEnabled()) { LOG.debug("<== AuthorizationSession.publishResults: throwing exception: " + message); } throw new AccessDeniedException("Insufficient permissions for user '" + _user.getName() + "' (action=" + _access + ")"); } if (LOG.isDebugEnabled()) { LOG.debug("<== AuthorizationSession.publishResults()"); } }
AuthorizationSession { void publishResults() throws AccessDeniedException { if (LOG.isDebugEnabled()) { LOG.debug("==> AuthorizationSession.publishResults()"); } boolean authorized = isAuthorized(); if (_auditHandler != null) { List<AuthzAuditEvent> events = null; if (authorized) { List<AuthzAuditEvent> theseEvents = _auditHandler.getCapturedEvents(); if (theseEvents != null && !theseEvents.isEmpty()) { events = theseEvents; } } else { AuthzAuditEvent event = _auditHandler.getAndDiscardMostRecentEvent(); if (event != null) { events = Lists.newArrayList(event); } } if (LOG.isDebugEnabled()) { int size = events == null ? 0 : events.size(); String auditMessage = events == null ? "" : events.toString(); String message = String.format("Writing %d messages to audit: [%s]", size, auditMessage); LOG.debug(message); } _auditHandler.logAuthzAudits(events); } if (!authorized) { String reason = getDenialReason(); String message = getLogMessage(false, reason); if (LOG.isDebugEnabled()) { LOG.debug("<== AuthorizationSession.publishResults: throwing exception: " + message); } throw new AccessDeniedException("Insufficient permissions for user '" + _user.getName() + "' (action=" + _access + ")"); } if (LOG.isDebugEnabled()) { LOG.debug("<== AuthorizationSession.publishResults()"); } } }
AuthorizationSession { void publishResults() throws AccessDeniedException { if (LOG.isDebugEnabled()) { LOG.debug("==> AuthorizationSession.publishResults()"); } boolean authorized = isAuthorized(); if (_auditHandler != null) { List<AuthzAuditEvent> events = null; if (authorized) { List<AuthzAuditEvent> theseEvents = _auditHandler.getCapturedEvents(); if (theseEvents != null && !theseEvents.isEmpty()) { events = theseEvents; } } else { AuthzAuditEvent event = _auditHandler.getAndDiscardMostRecentEvent(); if (event != null) { events = Lists.newArrayList(event); } } if (LOG.isDebugEnabled()) { int size = events == null ? 0 : events.size(); String auditMessage = events == null ? "" : events.toString(); String message = String.format("Writing %d messages to audit: [%s]", size, auditMessage); LOG.debug(message); } _auditHandler.logAuthzAudits(events); } if (!authorized) { String reason = getDenialReason(); String message = getLogMessage(false, reason); if (LOG.isDebugEnabled()) { LOG.debug("<== AuthorizationSession.publishResults: throwing exception: " + message); } throw new AccessDeniedException("Insufficient permissions for user '" + _user.getName() + "' (action=" + _access + ")"); } if (LOG.isDebugEnabled()) { LOG.debug("<== AuthorizationSession.publishResults()"); } } AuthorizationSession(RangerBasePlugin authorizer); }
AuthorizationSession { void publishResults() throws AccessDeniedException { if (LOG.isDebugEnabled()) { LOG.debug("==> AuthorizationSession.publishResults()"); } boolean authorized = isAuthorized(); if (_auditHandler != null) { List<AuthzAuditEvent> events = null; if (authorized) { List<AuthzAuditEvent> theseEvents = _auditHandler.getCapturedEvents(); if (theseEvents != null && !theseEvents.isEmpty()) { events = theseEvents; } } else { AuthzAuditEvent event = _auditHandler.getAndDiscardMostRecentEvent(); if (event != null) { events = Lists.newArrayList(event); } } if (LOG.isDebugEnabled()) { int size = events == null ? 0 : events.size(); String auditMessage = events == null ? "" : events.toString(); String message = String.format("Writing %d messages to audit: [%s]", size, auditMessage); LOG.debug(message); } _auditHandler.logAuthzAudits(events); } if (!authorized) { String reason = getDenialReason(); String message = getLogMessage(false, reason); if (LOG.isDebugEnabled()) { LOG.debug("<== AuthorizationSession.publishResults: throwing exception: " + message); } throw new AccessDeniedException("Insufficient permissions for user '" + _user.getName() + "' (action=" + _access + ")"); } if (LOG.isDebugEnabled()) { LOG.debug("<== AuthorizationSession.publishResults()"); } } AuthorizationSession(RangerBasePlugin authorizer);  }
AuthorizationSession { void publishResults() throws AccessDeniedException { if (LOG.isDebugEnabled()) { LOG.debug("==> AuthorizationSession.publishResults()"); } boolean authorized = isAuthorized(); if (_auditHandler != null) { List<AuthzAuditEvent> events = null; if (authorized) { List<AuthzAuditEvent> theseEvents = _auditHandler.getCapturedEvents(); if (theseEvents != null && !theseEvents.isEmpty()) { events = theseEvents; } } else { AuthzAuditEvent event = _auditHandler.getAndDiscardMostRecentEvent(); if (event != null) { events = Lists.newArrayList(event); } } if (LOG.isDebugEnabled()) { int size = events == null ? 0 : events.size(); String auditMessage = events == null ? "" : events.toString(); String message = String.format("Writing %d messages to audit: [%s]", size, auditMessage); LOG.debug(message); } _auditHandler.logAuthzAudits(events); } if (!authorized) { String reason = getDenialReason(); String message = getLogMessage(false, reason); if (LOG.isDebugEnabled()) { LOG.debug("<== AuthorizationSession.publishResults: throwing exception: " + message); } throw new AccessDeniedException("Insufficient permissions for user '" + _user.getName() + "' (action=" + _access + ")"); } if (LOG.isDebugEnabled()) { LOG.debug("<== AuthorizationSession.publishResults()"); } } AuthorizationSession(RangerBasePlugin authorizer);   }