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.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.archiva.admin.model.beans.ManagedRepository;
|
||||||
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
|
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
|
||||||
import org.apache.archiva.rest.api.model.BrowseResult;
|
import org.apache.archiva.rest.api.model.BrowseResult;
|
||||||
import org.apache.archiva.rest.api.model.VersionsList;
|
import org.apache.archiva.rest.api.model.VersionsList;
|
||||||
|
@ -70,6 +71,6 @@ public interface BrowseService
|
||||||
@GET
|
@GET
|
||||||
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
|
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
|
||||||
@RedbackAuthorization( noPermission = true, noRestriction = true )
|
@RedbackAuthorization( noPermission = true, noRestriction = true )
|
||||||
List<String> getUserRepositories()
|
List<ManagedRepository> getUserRepositories()
|
||||||
throws ArchivaRestServiceException;
|
throws ArchivaRestServiceException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ public abstract class AbstractRestService
|
||||||
private List<AuditListener> auditListeners = new ArrayList<AuditListener>();
|
private List<AuditListener> auditListeners = new ArrayList<AuditListener>();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private UserRepositories userRepositories;
|
protected UserRepositories userRepositories;
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.archiva.rest.services;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.archiva.admin.model.beans.ManagedRepository;
|
||||||
import org.apache.archiva.common.utils.VersionComparator;
|
import org.apache.archiva.common.utils.VersionComparator;
|
||||||
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
|
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
|
||||||
import org.apache.archiva.metadata.repository.MetadataResolutionException;
|
import org.apache.archiva.metadata.repository.MetadataResolutionException;
|
||||||
|
@ -350,10 +351,10 @@ public class DefaultBrowseService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getUserRepositories()
|
public List<ManagedRepository> getUserRepositories()
|
||||||
throws ArchivaRestServiceException
|
throws ArchivaRestServiceException
|
||||||
{
|
{
|
||||||
return getObservableRepos();
|
return userRepositories.getAccessibleRepositories( )
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------
|
//---------------------------
|
||||||
|
|
|
@ -92,7 +92,13 @@ public class DefaultUserRepositories
|
||||||
return repoIds;
|
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
|
throws ArchivaSecurityException, AccessDeniedException, PrincipalNotFoundException
|
||||||
{
|
{
|
||||||
SecuritySession securitySession = createSession( principal );
|
SecuritySession securitySession = createSession( principal );
|
||||||
|
|
|
@ -90,14 +90,13 @@ public interface UserRepositories
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param principal
|
* @param principal
|
||||||
* @param operation
|
|
||||||
* @since 1.4-M3
|
* @since 1.4-M3
|
||||||
* @return
|
* @return
|
||||||
* @throws ArchivaSecurityException
|
* @throws ArchivaSecurityException
|
||||||
* @throws AccessDeniedException
|
* @throws AccessDeniedException
|
||||||
* @throws PrincipalNotFoundException
|
* @throws PrincipalNotFoundException
|
||||||
*/
|
*/
|
||||||
List<ManagedRepository> getAccessibleRepositories( String principal, String operation )
|
List<ManagedRepository> getAccessibleRepositories( String principal )
|
||||||
throws ArchivaSecurityException, AccessDeniedException, PrincipalNotFoundException;
|
throws ArchivaSecurityException, AccessDeniedException, PrincipalNotFoundException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class UserRepositoriesStub
|
||||||
this.repoIds = repoIds;
|
this.repoIds = repoIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ManagedRepository> getAccessibleRepositories( String principal, String operation )
|
public List<ManagedRepository> getAccessibleRepositories( String principal )
|
||||||
throws ArchivaSecurityException, AccessDeniedException, PrincipalNotFoundException
|
throws ArchivaSecurityException, AccessDeniedException, PrincipalNotFoundException
|
||||||
{
|
{
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
|
Loading…
Reference in New Issue