mirror of https://github.com/apache/archiva.git
enhance rest method to return ManagedRepository rather than simply string
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1301525 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ad1155b6a5
commit
684505391a
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public abstract class AbstractRestService
|
|||
private List<AuditListener> auditListeners = new ArrayList<AuditListener>();
|
||||
|
||||
@Inject
|
||||
private UserRepositories userRepositories;
|
||||
protected UserRepositories userRepositories;
|
||||
|
||||
|
||||
@Inject
|
||||
|
|
|
@ -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( )
|
||||
}
|
||||
|
||||
//---------------------------
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue