From 5acc1268974e3595bd1db8705f1117ce529ddf92 Mon Sep 17 00:00:00 2001 From: oleg-odysseus Date: Fri, 25 Oct 2024 19:46:56 +0200 Subject: [PATCH] Fixed issue where non-administrator tool editor was unable to save entities --- .../org/ohdsi/webapi/tool/ToolServiceImpl.java | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/main/java/org/ohdsi/webapi/tool/ToolServiceImpl.java b/src/main/java/org/ohdsi/webapi/tool/ToolServiceImpl.java index 097bed242..bf9b60bfc 100644 --- a/src/main/java/org/ohdsi/webapi/tool/ToolServiceImpl.java +++ b/src/main/java/org/ohdsi/webapi/tool/ToolServiceImpl.java @@ -2,9 +2,6 @@ import java.util.List; import java.util.stream.Collectors; - -import javax.ws.rs.ForbiddenException; - import org.ohdsi.webapi.service.AbstractDaoService; import org.ohdsi.webapi.shiro.Entities.UserEntity; import org.ohdsi.webapi.tool.converter.ToolConvertor; @@ -25,17 +22,11 @@ public ToolServiceImpl(ToolRepository toolRepository, ToolConvertor toolConverto public List getTools() { List tools = isAdmin() ? toolRepository.findAll() : toolRepository.findAllByIsEnabled(true); return tools.stream() - .map(tool -> { - ToolDTO dto = toolConvertor.toDTO(tool); - return dto; - }).collect(Collectors.toList()); + .map(toolConvertor::toDTO).collect(Collectors.toList()); } @Override public ToolDTO saveTool(ToolDTO toolDTO) { - if (!isAdmin()) { - throw new ForbiddenException(); - } Tool tool = saveToolFromDTO(toolDTO, getCurrentUser()); return toolConvertor.toDTO(toolRepository.saveAndFlush(tool)); } @@ -56,9 +47,6 @@ public ToolDTO getById(Integer id) { @Override public void delete(Integer id) { - if (!isAdmin()) { - throw new ForbiddenException(); - } toolRepository.delete(id); } } \ No newline at end of file