Skip to content

Commit

Permalink
#4405 Remove superuser test from endpoint
Browse files Browse the repository at this point in the history
Also reorganize test file.
  • Loading branch information
sekmiller committed Feb 1, 2018
1 parent 918e902 commit 9b0b46f
Show file tree
Hide file tree
Showing 2 changed files with 304 additions and 309 deletions.
7 changes: 2 additions & 5 deletions src/main/java/edu/harvard/iq/dataverse/api/Datasets.java
Original file line number Diff line number Diff line change
Expand Up @@ -442,16 +442,13 @@ public Response publishDataset(@PathParam("id") String id, @QueryParam("type") S
@Path("{id}/move/{targetDataverseAlias}")
public Response moveDataset(@PathParam("id") String id, @PathParam("targetDataverseAlias") String targetDataverseAlias) {
try{
User u = findUserOrDie();
if (!u.isSuperuser()) {
return error(Response.Status.FORBIDDEN, "Not a superuser");
}

User u = findUserOrDie();
Dataset ds = findDatasetOrDie(id);
Dataverse target = dataverseService.findByAlias(targetDataverseAlias);
if (target == null){
return error(Response.Status.BAD_REQUEST, "Target Dataverse not found.");
}
//Command requires Super user - it will be tested by the command
execCommand(new MoveDatasetCommand(
createDataverseRequest(u), ds, target
));
Expand Down
Loading

0 comments on commit 9b0b46f

Please sign in to comment.