Commit 40685204 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '1370-overlay-list' into 'devel_15.1.x'

return proper status code for non existing project

See merge request !1255
parents 2e067a25 efbc4b1c
Pipeline #34554 failed with stage
in 15 minutes and 30 seconds
......@@ -3,6 +3,8 @@ minerva (15.1.1) stable; urgency=medium
generated files that could not be opened in CellDesigner (#1363)
* Bug fix: zoom level change was not reflected in the url when submap was
opened (#1338)
* Bug fix: API call returning list of overlays returned for non existing
project returned access denied status insted Not Found (#1370)
-- Piotr Gawron <piotr.gawron@uni.lu> Thu, 23 Nov 2020 15:00:00 +0200
......
......@@ -29,7 +29,8 @@ public class OverlayController extends BaseController {
this.userService = userService;
}
@PreAuthorize("hasAnyAuthority('IS_ADMIN', 'READ_PROJECT:' + #projectId)")
@PreAuthorize("hasAnyAuthority('IS_ADMIN', 'READ_PROJECT:' + #projectId) "
+ "or not @projectService.projectExists(#projectId)")
@PostFilter("hasAuthority('IS_ADMIN')" +
" or hasAuthority('IS_CURATOR') and hasAuthority('READ_PROJECT:' + #projectId)" +
" or hasAuthority('READ_PROJECT:' + #projectId) and (filterObject['creator'] == authentication.name or filterObject['publicOverlay'])")
......
......@@ -112,4 +112,14 @@ public class OverlayControllerIntegrationTestWithoutTransaction extends Controll
removeUserInSeparateThread(user);
}
}
@Test
public void testListOverlaysByCreatorInNonExistingProject() throws Exception {
RequestBuilder request = get("/projects/NotExisting/overlays/?creator=blable");
mockMvc.perform(request)
.andExpect(status().isNotFound());
}
}
Markdown is supported
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