]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3755 Removed check on logged user in action plan service
authorJulien Lancelot <julien.lancelot@gmail.com>
Wed, 5 Jun 2013 15:47:31 +0000 (17:47 +0200)
committerJulien Lancelot <julien.lancelot@gmail.com>
Wed, 5 Jun 2013 15:47:31 +0000 (17:47 +0200)
sonar-server/src/main/java/org/sonar/server/issue/ActionPlanService.java
sonar-server/src/test/java/org/sonar/server/issue/ActionPlanServiceTest.java

index 3edbd696c8a0906ed4bffa902e2f56f0bceade98..ca929ec205eb04ca380ef0293e2d508069d6c181 100644 (file)
@@ -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());
index 05028775774f62cb2e485f416323693445c3e22c..0f310202f79bde22bcc967931ca5a7b7467813f1 100644 (file)
@@ -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));