fix entry delete

This commit is contained in:
_Bastler 2021-11-21 16:51:35 +01:00
parent dcdb140f67
commit b9211d2178

View File

@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.security.access.prepost.PreAuthorize; 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.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
@ -348,6 +349,8 @@ public class EntryController extends BaseController {
* *
* @param id the id * @param id the id
*/ */
@PreAuthorize("isAuthenticated()")
@DeleteMapping("{id}")
public void deteleEntry(@PathVariable("id") Long id) { public void deteleEntry(@PathVariable("id") Long id) {
Entry orgEntry = entryManager.get(id); Entry orgEntry = entryManager.get(id);
if (orgEntry == null || !orgEntry.getAuthor().equals(getCurrentUsername()) || orgEntry if (orgEntry == null || !orgEntry.getAuthor().equals(getCurrentUsername()) || orgEntry