@RequestMapping(value = "deleteTask")
    public @ResponseBody
    String deleteTask(@RequestParam Integer id, WebRequest webRequest) {
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        if (authentication.isAuthenticated() && (authentication.getPrincipal() instanceof User)) {
            TodoUser user = (TodoUser) webRequest.getAttribute("user", WebRequest.SCOPE_SESSION);
            TodoTask task = todoTasksDAO.findTaskById(id);
            if (task.getAuthor().getId().intValue() == user.getId().intValue()
                || task.getList().getPubStatus() == TodoList.STATUS_PUBLIC_EDIT
                || "ROLE_ADMIN".equals(user.getRole())) {
                todoTasksDAO.deleteTask(task);
                return "success";
            }
            return "access denied";
        }
        return "not authorised";
    }