]> source.dussan.org Git - archiva.git/commitdiff
enhance rest method to return ManagedRepository rather than simply string
authorOlivier Lamy <olamy@apache.org>
Fri, 16 Mar 2012 14:02:29 +0000 (14:02 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 16 Mar 2012 14:02:29 +0000 (14:02 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1301525 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/BrowseService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java
archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/archiva/security/DefaultUserRepositories.java
archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/archiva/security/UserRepositories.java
archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/security/UserRepositoriesStub.java

index 15ac8ebf16b282c4a7143c81a8e2697adcc689f5..77e251a115f5cfda89b49b368b96415cfac4e684 100644 (file)
@@ -18,6 +18,7 @@ package org.apache.archiva.rest.api.services;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.metadata.model.ProjectVersionMetadata;
 import org.apache.archiva.rest.api.model.BrowseResult;
 import org.apache.archiva.rest.api.model.VersionsList;
@@ -70,6 +71,6 @@ public interface BrowseService
     @GET
     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
     @RedbackAuthorization( noPermission = true, noRestriction = true )
-    List<String> getUserRepositories()
+    List<ManagedRepository> getUserRepositories()
         throws ArchivaRestServiceException;
 }
index 3cf1545b706cadbc53134cc6c642173c5288c8ec..0d8a142408f71fe40c2867530af16201a5ee6146 100644 (file)
@@ -59,7 +59,7 @@ public abstract class AbstractRestService
     private List<AuditListener> auditListeners = new ArrayList<AuditListener>();
 
     @Inject
-    private UserRepositories userRepositories;
+    protected UserRepositories userRepositories;
 
 
     @Inject
index 580b91f7aefcba5159c2accb543c05b6845008d8..11ed250ac7e47227990c818fe01898340e73571c 100644 (file)
@@ -18,6 +18,7 @@ package org.apache.archiva.rest.services;
  * under the License.
  */
 
+import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.common.utils.VersionComparator;
 import org.apache.archiva.metadata.model.ProjectVersionMetadata;
 import org.apache.archiva.metadata.repository.MetadataResolutionException;
@@ -350,10 +351,10 @@ public class DefaultBrowseService
         }
     }
 
-    public List<String> getUserRepositories()
+    public List<ManagedRepository> getUserRepositories()
         throws ArchivaRestServiceException
     {
-        return getObservableRepos();
+        return userRepositories.getAccessibleRepositories(  )
     }
 
     //---------------------------
index 7f27d7cc0ed0dfdae2016f5b258065faba4a7bca..cfd6da5c8d173f0dc49ac7f018ae78619ec518db 100644 (file)
@@ -92,7 +92,13 @@ public class DefaultUserRepositories
         return repoIds;
     }
 
-    public List<ManagedRepository> getAccessibleRepositories( String principal, String operation )
+    public List<ManagedRepository> getAccessibleRepositories( String principal )
+        throws ArchivaSecurityException, AccessDeniedException, PrincipalNotFoundException
+    {
+        return getAccessibleRepositories( principal, ArchivaRoleConstants.OPERATION_REPOSITORY_ACCESS );
+    }
+
+    private List<ManagedRepository> getAccessibleRepositories( String principal, String operation )
         throws ArchivaSecurityException, AccessDeniedException, PrincipalNotFoundException
     {
         SecuritySession securitySession = createSession( principal );
index 18a46855b00d5db6769a30642c1e4804c4dac4b0..d116f4d324313334989423b7d9f34efa9ede4c15 100644 (file)
@@ -90,14 +90,13 @@ public interface UserRepositories
     /**
      *
      * @param principal
-     * @param operation
      * @since 1.4-M3
      * @return
      * @throws ArchivaSecurityException
      * @throws AccessDeniedException
      * @throws PrincipalNotFoundException
      */
-    List<ManagedRepository> getAccessibleRepositories( String principal, String operation )
+    List<ManagedRepository> getAccessibleRepositories( String principal )
             throws ArchivaSecurityException, AccessDeniedException, PrincipalNotFoundException;
     
 }
index 73e4134227cc1238c3a64bef7b5092a2a1ad0f67..fb0e2105c3b667f72b9b1364bf88797f74e93577 100644 (file)
@@ -77,7 +77,7 @@ public class UserRepositoriesStub
         this.repoIds = repoIds;
     }
 
-    public List<ManagedRepository> getAccessibleRepositories( String principal, String operation )
+    public List<ManagedRepository> getAccessibleRepositories( String principal )
         throws ArchivaSecurityException, AccessDeniedException, PrincipalNotFoundException
     {
         return Collections.emptyList();