diff options
author | Brett Porter <brett@apache.org> | 2010-01-19 06:15:09 +0000 |
---|---|---|
committer | Brett Porter <brett@apache.org> | 2010-01-19 06:15:09 +0000 |
commit | 606c82cbcad53a9f2c0dd1212ce302e3c8626910 (patch) | |
tree | 721b99dd1c650636b7c9909eb843b909c0311ba1 /archiva-modules/archiva-web/archiva-webdav | |
parent | 685419f0824f9f788513d3f3c3b89eac58118fe6 (diff) | |
parent | 96c99628aab4b63d71e660b661120596868a7f25 (diff) | |
download | archiva-606c82cbcad53a9f2c0dd1212ce302e3c8626910.tar.gz archiva-606c82cbcad53a9f2c0dd1212ce302e3c8626910.zip |
merged recent changes from trunk, and reimplemented incoming audit log functionality as a plugin using the metadata repository
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/MRM-1025@900664 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web/archiva-webdav')
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", |