Search in sources :

Example 1 with AuditInformation

use of org.apache.archiva.admin.model.AuditInformation in project archiva by apache.

the class AbstractRestService method triggerAuditEvent.

protected void triggerAuditEvent(String repositoryId, String filePath, String action) {
    AuditEvent auditEvent = new AuditEvent(repositoryId, getPrincipal(), filePath, action);
    AuditInformation auditInformation = getAuditInformation();
    auditEvent.setUserId(auditInformation.getUser() == null ? "" : auditInformation.getUser().getUsername());
    auditEvent.setRemoteIP(auditInformation.getRemoteAddr());
    for (AuditListener auditListener : getAuditListeners()) {
        auditListener.auditEvent(auditEvent);
    }
}
Also used : AuditInformation(org.apache.archiva.admin.model.AuditInformation) AuditEvent(org.apache.archiva.metadata.model.facets.AuditEvent) AuditListener(org.apache.archiva.repository.events.AuditListener)

Example 2 with AuditInformation

use of org.apache.archiva.admin.model.AuditInformation in project archiva by apache.

the class AbstractRestService method getAuditInformation.

protected AuditInformation getAuditInformation() {
    RedbackRequestInformation redbackRequestInformation = RedbackAuthenticationThreadLocal.get();
    User user = redbackRequestInformation == null ? null : redbackRequestInformation.getUser();
    String remoteAddr = redbackRequestInformation == null ? null : redbackRequestInformation.getRemoteAddr();
    return new AuditInformation(user, remoteAddr);
}
Also used : AuditInformation(org.apache.archiva.admin.model.AuditInformation) User(org.apache.archiva.redback.users.User) RedbackRequestInformation(org.apache.archiva.redback.rest.services.RedbackRequestInformation)

Aggregations

AuditInformation (org.apache.archiva.admin.model.AuditInformation)2 AuditEvent (org.apache.archiva.metadata.model.facets.AuditEvent)1 RedbackRequestInformation (org.apache.archiva.redback.rest.services.RedbackRequestInformation)1 User (org.apache.archiva.redback.users.User)1 AuditListener (org.apache.archiva.repository.events.AuditListener)1