From b9211d217830c62de38982dce2753cec5c14c33f Mon Sep 17 00:00:00 2001 From: _Bastler Date: Sun, 21 Nov 2021 16:51:35 +0100 Subject: [PATCH] fix entry delete --- src/main/java/de/bstly/board/controller/EntryController.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/de/bstly/board/controller/EntryController.java b/src/main/java/de/bstly/board/controller/EntryController.java index 04eb0fc..97d9029 100644 --- a/src/main/java/de/bstly/board/controller/EntryController.java +++ b/src/main/java/de/bstly/board/controller/EntryController.java @@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.http.HttpStatus; import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -348,6 +349,8 @@ public class EntryController extends BaseController { * * @param id the id */ + @PreAuthorize("isAuthenticated()") + @DeleteMapping("{id}") public void deteleEntry(@PathVariable("id") Long id) { Entry orgEntry = entryManager.get(id); if (orgEntry == null || !orgEntry.getAuthor().equals(getCurrentUsername()) || orgEntry