Search in sources :

Example 1 with Audit

use of com.google.gerrit.common.audit.Audit in project gerrit by GerritCodeReview.

the class GerritJsonServlet method audit.

private void audit() {
    try {
        GerritCall call = currentCall.get();
        MethodHandle method = call.getMethod();
        if (method == null) {
            return;
        }
        Audit note = method.getAnnotation(Audit.class);
        if (note != null) {
            String sid = call.getWebSession().getSessionId();
            CurrentUser username = call.getWebSession().getUser();
            ListMultimap<String, ?> args = extractParams(note, call);
            String what = extractWhat(note, call);
            Object result = call.getResult();
            audit.dispatch(new RpcAuditEvent(sid, username, what, call.getWhen(), args, call.getHttpServletRequest().getMethod(), call.getHttpServletRequest().getMethod(), ((AuditedHttpServletResponse) (call.getHttpServletResponse())).getStatus(), result));
        }
    } catch (Throwable all) {
        log.error("Unable to log the call", all);
    }
}
Also used : Audit(com.google.gerrit.common.audit.Audit) RpcAuditEvent(com.google.gerrit.audit.RpcAuditEvent) CurrentUser(com.google.gerrit.server.CurrentUser) MethodHandle(com.google.gwtjsonrpc.server.MethodHandle)

Aggregations

RpcAuditEvent (com.google.gerrit.audit.RpcAuditEvent)1 Audit (com.google.gerrit.common.audit.Audit)1 CurrentUser (com.google.gerrit.server.CurrentUser)1 MethodHandle (com.google.gwtjsonrpc.server.MethodHandle)1