]> source.dussan.org Git - archiva.git/commitdiff
[MRM-694]
authorMaria Odea B. Ching <oching@apache.org>
Wed, 21 May 2008 01:39:40 +0000 (01:39 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Wed, 21 May 2008 01:39:40 +0000 (01:39 +0000)
-put authorization check for virtual repos

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@658525 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/util/IndexWriter.java

index f8f71dfbc9904cf41861b681f2e7db6061724fdf..4ee011dc62e9e8d881090a032f7f9c9957160d3c 100644 (file)
@@ -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 );
+                        }                    
+                    }
                 }
             }
         }      
index 3c6b07f2047d6fe7c4cf4b565a21447cade4e6e8..4854344a20defceda7a2a994e18e7433517c40db 100644 (file)
@@ -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 )
             {