summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaria Odea B. Ching <oching@apache.org>2008-05-21 01:39:40 +0000
committerMaria Odea B. Ching <oching@apache.org>2008-05-21 01:39:40 +0000
commit0f07e0019f4a532ce0cb6b0df685ba18d106b243 (patch)
treeaad64a082fa16149626d58f7bdf21c7921ecf26f
parent62b7ecc6e29eef5a46c86e6a64b303a8d72d8d56 (diff)
downloadarchiva-0f07e0019f4a532ce0cb6b0df685ba18d106b243.tar.gz
archiva-0f07e0019f4a532ce0cb6b0df685ba18d106b243.zip
[MRM-694]
-put authorization check for virtual repos git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@658525 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java23
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java4
2 files changed, 15 insertions, 12 deletions
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 f8f71dfbc..4ee011dc6 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
@@ -147,7 +147,7 @@ public class ArchivaDavResourceFactory
// handle browse requests for virtual repos
if ( RepositoryPathUtil.getLogicalResource( locator.getResourcePath() ).endsWith( "/" ) )
{
- return getResource( repositories, archivaLocator );
+ return getResource( request, repositories, archivaLocator );
}
}
else
@@ -664,7 +664,7 @@ public class ArchivaDavResourceFactory
}
}
- private DavResource getResource( List<String> repositories, ArchivaDavResourceLocator locator )
+ private DavResource getResource( DavServletRequest request, List<String> repositories, ArchivaDavResourceLocator locator )
throws DavException
{
List<File> mergedRepositoryContents = new ArrayList<File>();
@@ -685,15 +685,18 @@ public class ArchivaDavResourceFactory
repository + ">" );
}
- if ( !locator.getResourcePath().startsWith( ArchivaVirtualDavResource.HIDDEN_PATH_PREFIX ) )
+ if( isAuthorized( request, repository ) )
{
- if( managedRepository != null )
- {
- File resourceFile = new File( managedRepository.getRepoRoot(), logicalResource.getPath() );
- if( resourceFile.exists() )
- {
- mergedRepositoryContents.add( resourceFile );
- }
+ if ( !locator.getResourcePath().startsWith( ArchivaVirtualDavResource.HIDDEN_PATH_PREFIX ) )
+ {
+ if( managedRepository != null )
+ {
+ File resourceFile = new File( managedRepository.getRepoRoot(), logicalResource.getPath() );
+ if( resourceFile.exists() )
+ {
+ mergedRepositoryContents.add( resourceFile );
+ }
+ }
}
}
}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java
index 3c6b07f20..4854344a2 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java
@@ -129,8 +129,7 @@ public class IndexWriter
for( File resource : localResources )
{
List<File> files = new ArrayList<File>( Arrays.asList( resource.listFiles() ) );
- Collections.sort( files );
-
+
for ( File file : files )
{
if( uniqueChildFiles.get( file.getName() ) == null )
@@ -142,6 +141,7 @@ public class IndexWriter
List<File> uniqueChildFilesInList = new ArrayList<File>();
uniqueChildFilesInList.addAll( uniqueChildFiles.values() );
+ Collections.sort( uniqueChildFilesInList );
for ( File file : uniqueChildFilesInList )
{