Skip to content
Snippets Groups Projects
Commit 20a8c0dc authored by Paul-Christian Volkmer's avatar Paul-Christian Volkmer
Browse files

Removed obsolete code

Spring security based permission check will do this for us.
parent 9aae9310
No related merge requests found
......@@ -138,12 +138,6 @@ public class SessionController extends AbstractController {
User user = userService.getCurrentUser();
List<Session> sessions = null;
/* TODO Could @Authorized annotation be used instead of this check? */
if (null == user) {
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
return null;
}
/* TODO implement all parameter combinations, implement use of user parameter */
if (ownedOnly && !visitedOnly) {
sessions = sessionService.getMySessions(user);
......
......@@ -85,4 +85,28 @@ public class SessionControllerTest {
mockMvc.perform(post("/session/").contentType(MediaType.APPLICATION_JSON).content("{\"keyword\":12345678}"))
.andExpect(status().isUnauthorized());
}
@Test
public void testShouldNotReturnMySessionsIfUnauthorized() throws Exception {
setAuthenticated(false);
mockMvc.perform(get("/session/").param("ownedonly", "true"))
.andExpect(status().isUnauthorized());
}
@Test
public void testShouldNotReturnMyVisitedSessionsIfUnauthorized() throws Exception {
setAuthenticated(false);
mockMvc.perform(get("/session/").param("visitedonly", "true"))
.andExpect(status().isUnauthorized());
}
@Test
public void testShouldShowUnimplementedIfNoFlagIsSet() throws Exception {
setAuthenticated(false);
mockMvc.perform(get("/session/"))
.andExpect(status().isNotImplemented());
}
}
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