summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web/archiva-webdav
diff options
context:
space:
mode:
Diffstat (limited to 'archiva-modules/archiva-web/archiva-webdav')
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/pom.xml2
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java12
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java2
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java6
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java5
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletSecurityTest.java6
6 files changed, 22 insertions, 11 deletions
diff --git a/archiva-modules/archiva-web/archiva-webdav/pom.xml b/archiva-modules/archiva-web/archiva-webdav/pom.xml
index 95341522e..d85241cee 100644
--- a/archiva-modules/archiva-web/archiva-webdav/pom.xml
+++ b/archiva-modules/archiva-web/archiva-webdav/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-web</artifactId>
- <version>1.3-SNAPSHOT</version>
+ <version>1.4-SNAPSHOT</version>
</parent>
<artifactId>archiva-webdav</artifactId>
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java
index eff87127e..23727d0b4 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java
@@ -403,9 +403,15 @@ public class ArchivaDavResource
private void triggerAuditEvent( DavResource member, String event ) throws DavException
{
String path = logicalResource + "/" + member.getDisplayName();
-
- triggerAuditEvent( checkDavResourceIsArchivaDavResource( member ).remoteAddr, locator.getRepositoryId(), path,
- event );
+
+ ArchivaDavResource resource = checkDavResourceIsArchivaDavResource( member );
+ AuditEvent auditEvent = new AuditEvent( locator.getRepositoryId(), resource.principal, path, event );
+ auditEvent.setRemoteIP( resource.remoteAddr );
+
+ for ( AuditListener listener : auditListeners )
+ {
+ listener.auditEvent( auditEvent );
+ }
}
public void move( DavResource destination )
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
index c1cd85cf3..e92f87a32 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
@@ -528,7 +528,7 @@ public class ArchivaDavResourceFactory
log.debug( "Creating destination directory '" + destDir.getName() + "' (current user '" +
activePrincipal + "')" );
- triggerAuditEvent( request.getRemoteAddr(), logicalResource.getPath(), relPath,
+ triggerAuditEvent( request.getRemoteAddr(), managedRepository.getId(), relPath,
AuditEvent.CREATE_DIR, activePrincipal );
}
}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java
index b2f38fdb4..0d30388bb 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactoryTest.java
@@ -81,7 +81,7 @@ public class ArchivaDavResourceFactoryTest
private MockControl repoContentFactoryControl;
private RepositoryContentFactory repoFactory;
-
+
public void setUp()
throws Exception
{
@@ -96,7 +96,7 @@ public class ArchivaDavResourceFactoryTest
archivaConfigurationControl = MockControl.createControl( ArchivaConfiguration.class );
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
-
+
config = new Configuration();
config.addManagedRepository( createManagedRepository( RELEASES_REPO, new File( getBasedir(),
"target/test-classes/" +
@@ -392,7 +392,7 @@ public class ArchivaDavResourceFactoryTest
long date = 2039842134;
response.addDateHeader( "last-modified", date );
responseControl.setVoidCallable();
-
+
archivaConfigurationControl.replay();
repoContentFactoryControl.replay();
requestControl.replay();
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java
index 8b656d8ec..8e22e72de 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/DavResourceTest.java
@@ -77,11 +77,12 @@ public class DavResourceTest
myResource = new File( baseDir, "myresource.jar" );
assertTrue( "Could not create " + myResource.getAbsolutePath(), myResource.createNewFile() );
resourceFactory = new RootContextDavResourceFactory();
+
resourceLocator =
- (ArchivaDavResourceLocator) new ArchivaDavLocatorFactory().createResourceLocator( "/", REPOPATH );
+ (ArchivaDavResourceLocator) new ArchivaDavLocatorFactory().createResourceLocator( "/", REPOPATH );
resource = getDavResource( resourceLocator.getHref( false ), myResource );
lockManager = new SimpleLockManager();
- resource.addLockManager( lockManager );
+ resource.addLockManager( lockManager );
}
@Override
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletSecurityTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletSecurityTest.java
index 9066331de..f4119959f 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletSecurityTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletSecurityTest.java
@@ -39,6 +39,7 @@ import org.codehaus.plexus.redback.authentication.AuthenticationResult;
import org.codehaus.plexus.redback.authorization.UnauthorizedException;
import org.codehaus.plexus.redback.system.DefaultSecuritySession;
import org.codehaus.plexus.redback.system.SecuritySession;
+import org.codehaus.plexus.redback.users.User;
import org.codehaus.plexus.redback.users.memory.SimpleUser;
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
@@ -352,11 +353,14 @@ public class RepositoryServletSecurityTest
httpAuthControl.expectAndReturn( httpAuth.getAuthenticationResult( null, null ), result );
servletAuthControl.expectAndReturn( servletAuth.isAuthenticated( null, null ), true );
+ User user = new SimpleUser();
+ user.setUsername( "admin" );
+
// ArchivaDavResourceFactory#isAuthorized()
SecuritySession session = new DefaultSecuritySession();
httpAuthControl.expectAndReturn( httpAuth.getAuthenticationResult( null, null ), result );
httpAuthControl.expectAndReturn( httpAuth.getSecuritySession( ic.getRequest().getSession( true ) ), session );
- httpAuthControl.expectAndReturn( httpAuth.getSessionUser( ic.getRequest().getSession() ), new SimpleUser() );
+ httpAuthControl.expectAndReturn( httpAuth.getSessionUser( ic.getRequest().getSession() ), user );
servletAuthControl.expectAndReturn( servletAuth.isAuthenticated( null, result ), true );
servletAuthControl.expectAndReturn(
servletAuth.isAuthorized( null, session, "internal",