Commit e1e2b978 authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

fixed transactional issue in OverlayController

parent ef9d2a2c
......@@ -57,7 +57,7 @@ public class OverlayController extends BaseController {
@PreAuthorize("hasAuthority('IS_ADMIN')" +
" or hasAuthority('IS_CURATOR') and hasAuthority('READ_PROJECT:' + #projectId)" +
" or hasAuthority('READ_PROJECT:' + #projectId) and @layoutDao.getById(#overlayId).creator.login == authentication.name")
" or hasAuthority('READ_PROJECT:' + #projectId) and @layoutService.getLayoutById(#overlayId)?.creator?.login == authentication.name")
@GetMapping(value = "/{overlayId}/models/{modelId}/bioEntities/")
public List<Map<String, Object>> getOverlayElements(
@PathVariable(value = "projectId") String projectId,
......@@ -68,7 +68,7 @@ public class OverlayController extends BaseController {
@PreAuthorize("hasAuthority('IS_ADMIN')" +
" or hasAuthority('IS_CURATOR') and hasAuthority('READ_PROJECT:' + #projectId)" +
" or hasAuthority('READ_PROJECT:' + #projectId) and @layoutDao.getById(#overlayId).creator.login == authentication.name")
" or hasAuthority('READ_PROJECT:' + #projectId) and @layoutService.getLayoutById(#overlayId)?.creator?.login == authentication.name")
@GetMapping(value = "/{overlayId}/models/{modelId}/bioEntities/reactions/{reactionId}/")
public Map<String, Object> getFullReaction(
@PathVariable(value = "projectId") String projectId,
......@@ -82,7 +82,7 @@ public class OverlayController extends BaseController {
@PreAuthorize("hasAuthority('IS_ADMIN')" +
" or hasAuthority('IS_CURATOR') and hasAuthority('READ_PROJECT:' + #projectId)" +
" or hasAuthority('READ_PROJECT:' + #projectId) and @layoutDao.getById(#overlayId).creator.login == authentication.name")
" or hasAuthority('READ_PROJECT:' + #projectId) and @layoutService.getLayoutById(#overlayId)?.creator?.login == authentication.name")
@GetMapping(value = "/{overlayId}/models/{modelId}/bioEntities/elements/{elementId}/")
public Map<String, Object> getFullSpecies(
@PathVariable(value = "projectId") String projectId,
......@@ -115,7 +115,7 @@ public class OverlayController extends BaseController {
@PreAuthorize("hasAuthority('IS_ADMIN')" +
"or hasAuthority('IS_CURATOR') and hasAuthority('WRITE_PROJECT:' + #projectId)" +
"or hasAuthority('READ_PROJECT:' + #projectId) and @layoutDao.getById(#overlayId).creator.login == authentication.name")
"or hasAuthority('READ_PROJECT:' + #projectId) and @layoutService.getLayoutById(#overlayId)?.creator?.login == authentication.name")
@DeleteMapping(value = "/{overlayId}")
public Map<String, Object> removeOverlay(
@PathVariable(value = "projectId") String projectId,
......@@ -124,9 +124,9 @@ public class OverlayController extends BaseController {
}
@PreAuthorize("hasAuthority('IS_ADMIN')" +
" or hasAuthority('IS_CURATOR') and hasAuthority('WRITE_PROJECT:' + @layoutDao.getById(#overlayId).project.projectId)"
" or hasAuthority('IS_CURATOR') and hasAuthority('WRITE_PROJECT:' + @layoutService.getLayoutById(#overlayId)?.project?.projectId)"
+
" or hasAuthority('READ_PROJECT:' + @layoutDao.getById(#overlayId).project.projectId) and @layoutDao.getById(#overlayId).creator.login == authentication.name")
" or hasAuthority('READ_PROJECT:' + @layoutService.getLayoutById(#overlayId)?.project?.projectId) and @layoutService.getLayoutById(#overlayId)?.creator?.login == authentication.name")
@PatchMapping(value = "/{overlayId}")
public Map<String, Object> updateOverlay(
@RequestBody String body,
......@@ -139,7 +139,7 @@ public class OverlayController extends BaseController {
@PreAuthorize("hasAuthority('IS_ADMIN')" +
" or hasAuthority('IS_CURATOR') and hasAuthority('READ_PROJECT:' + #projectId)" +
" or hasAuthority('READ_PROJECT:' + #projectId) and @layoutDao.getById(#overlayId).creator.login == authentication.name")
" or hasAuthority('READ_PROJECT:' + #projectId) and @layoutService.getLayoutById(#overlayId)?.creator?.login == authentication.name")
@GetMapping(value = "/{overlayId}:downloadSource")
public ResponseEntity<byte[]> getOverlaySource(
@PathVariable(value = "projectId") String projectId,
......
......@@ -555,7 +555,6 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
assertEquals(1, layoutDao.getLayoutsByProject(project).size());
}
@Ignore("Test seems to be broken with hibernate exceptions")
@Test
public void testCuratorCreateOverlay() throws Exception {
User curator = createCurator(TEST_CURATOR_LOGIN, TEST_CURATOR_PASSWORD, project);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment