Add auth check before clearing all paragraph

This commit is contained in:
Mina Lee 2016-11-03 15:45:41 +09:00
parent fb7e6ae0c5
commit 2ee452ec0b
2 changed files with 4 additions and 8 deletions

View file

@ -528,14 +528,11 @@ public class NotebookRestApi {
public Response clearAllParagraphOutput(@PathParam("noteId") String noteId)
throws IOException {
LOG.info("clear all paragraph output of note {}", noteId);
checkIfUserCanWrite(noteId, "Insufficient privileges you cannot clear this note");
if (!noteId.isEmpty()) {
Note note = notebook.getNote(noteId);
if (note == null) {
return new JsonResponse(Status.NOT_FOUND, "note not found.").build();
}
note.clearAllParagraphOutput();
}
Note note = notebook.getNote(noteId);
checkIfNoteIsNotNull(note);
note.clearAllParagraphOutput();
return new JsonResponse(Status.OK, "").build();
}

View file

@ -36,7 +36,6 @@ import org.junit.Test;
import org.junit.runners.MethodSorters;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Set;