merge repositories rest service: users must have karma for this operation

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1389245 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-09-24 08:45:49 +00:00
parent af25183857
commit 0d2eed326e
2 changed files with 14 additions and 11 deletions

View File

@ -65,6 +65,8 @@ public class ArchivaRoleConstants
public static final String OPERATION_REPOSITORY_UPLOAD = "archiva-upload-repository"; public static final String OPERATION_REPOSITORY_UPLOAD = "archiva-upload-repository";
public static final String OPERATION_REPOSITORY_DELETE = "archiva-delete-artifact"; public static final String OPERATION_REPOSITORY_DELETE = "archiva-delete-artifact";
public static final String OPERATION_MERGE_REPOSITORY = "archiva-merge-repository";
public static final String OPERATION_VIEW_AUDIT_LOG = "archiva-view-audit-logs"; public static final String OPERATION_VIEW_AUDIT_LOG = "archiva-view-audit-logs";

View File

@ -20,6 +20,7 @@ package org.apache.archiva.rest.api.services;
import org.apache.archiva.maven2.model.Artifact; import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.redback.authorization.RedbackAuthorization; import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.security.common.ArchivaRoleConstants;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.Path; import javax.ws.rs.Path;
@ -34,30 +35,30 @@ import java.util.List;
* @author Olivier Lamy * @author Olivier Lamy
* @since 1.4-M3 * @since 1.4-M3
*/ */
@Path ( "/mergeRepositoriesService/" ) @Path ("/mergeRepositoriesService/")
public interface MergeRepositoriesService public interface MergeRepositoriesService
{ {
@Path ( "mergeConflictedArtifacts/{sourceRepositoryId}/{targetRepositoryId}" ) @Path ("mergeConflictedArtifacts/{sourceRepositoryId}/{targetRepositoryId}")
@GET @GET
@Produces ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@RedbackAuthorization ( noPermission = true ) @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_MERGE_REPOSITORY)
/** /**
* <b>permissions are checked in impl</b> * <b>permissions are checked in impl</b>
* @since 1.4-M3 * @since 1.4-M3
*/ */
List<Artifact> getMergeConflictedArtifacts( @PathParam ( "sourceRepositoryId" ) String sourceRepositoryId, List<Artifact> getMergeConflictedArtifacts( @PathParam ("sourceRepositoryId") String sourceRepositoryId,
@PathParam ( "targetRepositoryId" ) String targetRepositoryId ) @PathParam ("targetRepositoryId") String targetRepositoryId )
throws ArchivaRestServiceException; throws ArchivaRestServiceException;
@Path ( "mergeRepositories/{sourceRepositoryId}/{targetRepositoryId}/{skipConflicts}" ) @Path ("mergeRepositories/{sourceRepositoryId}/{targetRepositoryId}/{skipConflicts}")
@GET @GET
@RedbackAuthorization ( noPermission = true ) @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_MERGE_REPOSITORY)
/** /**
* <b>permissions are checked in impl</b> * <b>permissions are checked in impl</b>
* @since 1.4-M3 * @since 1.4-M3
*/ */
void mergeRepositories( @PathParam ( "sourceRepositoryId" ) String sourceRepositoryId, void mergeRepositories( @PathParam ("sourceRepositoryId") String sourceRepositoryId,
@PathParam ( "targetRepositoryId" ) String targetRepositoryId, @PathParam ("targetRepositoryId") String targetRepositoryId,
@PathParam ( "skipConflicts" ) boolean skipConflicts ) @PathParam ("skipConflicts") boolean skipConflicts )
throws ArchivaRestServiceException; throws ArchivaRestServiceException;
} }