mirror of https://github.com/apache/archiva.git
fix test problems
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@756587 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6681581426
commit
34c163502b
|
@ -46,7 +46,7 @@ public class AuditLog
|
|||
StringBuffer msg = new StringBuffer();
|
||||
msg.append( checkNull( event.getRepositoryId() ) ).append( DELIM );
|
||||
msg.append( event.getUserId() ).append( DELIM );
|
||||
msg.append( event.getRemoteIP() ).append( DELIM );
|
||||
msg.append( checkNull( event.getRemoteIP() ) ).append( DELIM );
|
||||
msg.append( '\"' ).append( checkNull( event.getResource() ) ).append( '\"' ).append( DELIM );
|
||||
msg.append( '\"' ).append( event.getAction() ).append( '\"' );
|
||||
|
||||
|
|
|
@ -40,6 +40,11 @@ public final class ArchivaXworkUser
|
|||
|
||||
public static String getActivePrincipal( Map<String, ?> sessionMap )
|
||||
{
|
||||
if ( sessionMap == null )
|
||||
{
|
||||
return UserManager.GUEST_USERNAME;
|
||||
}
|
||||
|
||||
SecuritySession securitySession =
|
||||
(SecuritySession) sessionMap.get( SecuritySystemConstants.SECURITY_SESSION_KEY );
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.maven.archiva.repository.audit.AuditEvent;
|
||||
import org.apache.maven.archiva.repository.audit.AuditListener;
|
||||
import org.apache.maven.archiva.repository.audit.Auditable;
|
||||
|
@ -75,7 +77,7 @@ public abstract class PlexusActionSupport
|
|||
protected void triggerAuditEvent( String repositoryId, String resource, String action )
|
||||
{
|
||||
AuditEvent event = new AuditEvent( repositoryId, getPrincipal(), resource, action );
|
||||
event.setRemoteIP( ServletActionContext.getRequest().getRemoteAddr() );
|
||||
event.setRemoteIP( getRemoteAddr() );
|
||||
|
||||
for ( AuditListener listener : auditListeners )
|
||||
{
|
||||
|
@ -86,7 +88,7 @@ public abstract class PlexusActionSupport
|
|||
protected void triggerAuditEvent( String resource, String action )
|
||||
{
|
||||
AuditEvent event = new AuditEvent( getPrincipal(), resource, action );
|
||||
event.setRemoteIP( ServletActionContext.getRequest().getRemoteAddr() );
|
||||
event.setRemoteIP( getRemoteAddr() );
|
||||
|
||||
for ( AuditListener listener : auditListeners )
|
||||
{
|
||||
|
@ -97,7 +99,7 @@ public abstract class PlexusActionSupport
|
|||
protected void triggerAuditEvent( String action )
|
||||
{
|
||||
AuditEvent event = new AuditEvent( getPrincipal(), action );
|
||||
event.setRemoteIP( ServletActionContext.getRequest().getRemoteAddr() );
|
||||
event.setRemoteIP( getRemoteAddr() );
|
||||
|
||||
for ( AuditListener listener : auditListeners )
|
||||
{
|
||||
|
@ -105,6 +107,12 @@ public abstract class PlexusActionSupport
|
|||
}
|
||||
}
|
||||
|
||||
private String getRemoteAddr()
|
||||
{
|
||||
HttpServletRequest request = ServletActionContext.getRequest();
|
||||
return request != null ? request.getRemoteAddr() : null;
|
||||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
protected String getPrincipal()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue