From f4cb88e5f41f607c3327a464f51f6b14626b862d Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Wed, 5 Jun 2013 17:47:31 +0200 Subject: [PATCH] SONAR-3755 Removed check on logged user in action plan service --- .../org/sonar/server/issue/ActionPlanService.java | 4 ---- .../sonar/server/issue/ActionPlanServiceTest.java | 15 --------------- 2 files changed, 19 deletions(-) diff --git a/sonar-server/src/main/java/org/sonar/server/issue/ActionPlanService.java b/sonar-server/src/main/java/org/sonar/server/issue/ActionPlanService.java index 3edbd696c8a..ca929ec205e 100644 --- a/sonar-server/src/main/java/org/sonar/server/issue/ActionPlanService.java +++ b/sonar-server/src/main/java/org/sonar/server/issue/ActionPlanService.java @@ -168,10 +168,6 @@ public class ActionPlanService implements ServerComponent { } private void checkAuthorization(UserSession userSession, ResourceDto project, String requiredRole) { - if (!userSession.isLoggedIn()) { - // must be logged - throw new IllegalStateException("User is not logged in"); - } if (!authorizationDao.isAuthorizedComponentId(project.getId(), userSession.userId(), requiredRole)) { // TODO throw unauthorized throw new IllegalStateException("User does not have the required role on the project: " + project.getKey()); diff --git a/sonar-server/src/test/java/org/sonar/server/issue/ActionPlanServiceTest.java b/sonar-server/src/test/java/org/sonar/server/issue/ActionPlanServiceTest.java index 05028775774..0f310202f79 100644 --- a/sonar-server/src/test/java/org/sonar/server/issue/ActionPlanServiceTest.java +++ b/sonar-server/src/test/java/org/sonar/server/issue/ActionPlanServiceTest.java @@ -72,21 +72,6 @@ public class ActionPlanServiceTest { verify(authorizationDao).isAuthorizedComponentId(anyLong(), anyInt(), eq(UserRole.ADMIN)); } - @Test - public void should_create_required_logged_user() { - when(resourceDao.getResource(any(ResourceQuery.class))).thenReturn(new ResourceDto().setKey("org.sonar.Sample").setId(1l)); - ActionPlan actionPlan = DefaultActionPlan.create("Long term"); - when(userSession.isLoggedIn()).thenReturn(false); - - try { - actionPlanService.create(actionPlan, userSession); - fail(); - } catch (Exception e) { - assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("User is not logged in"); - } - verifyZeroInteractions(actionPlanDao); - } - @Test public void should_create_required_admin_role() { when(resourceDao.getResource(any(ResourceQuery.class))).thenReturn(new ResourceDto().setKey("org.sonar.Sample").setId(1l)); -- 2.39.5