]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6311 Delete RoR WS api/profiles/destroy
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Fri, 2 Oct 2015 14:54:56 +0000 (16:54 +0200)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Mon, 5 Oct 2015 07:37:17 +0000 (09:37 +0200)
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProfilesWs.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProfilesWsTest.java
server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/profiles_controller.rb

index 6d9df46f23db056055042b1cbeb906623b23d913..dfae02a932757fdc46814d094b67018802b1d0f5 100644 (file)
@@ -37,7 +37,6 @@ public class ProfilesWs implements WebService {
     defineIndexAction(controller);
     defineBackupAction(controller);
     defineRestoreAction(controller);
-    defineDestroyAction(controller);
 
     controller.done();
   }
@@ -88,21 +87,4 @@ public class ProfilesWs implements WebService {
       .setDescription("Path to the file containing the backup (HTML format)");
     RailsHandler.addJsonOnlyFormatParam(action);
   }
-
-  private static void defineDestroyAction(NewController controller) {
-    WebService.NewAction action = controller.createAction("destroy")
-      .setDescription("Delete a quality profile. Requires Administer Quality Profiles permission")
-      .setSince("3.3")
-      .setPost(true)
-      .setHandler(RailsHandler.INSTANCE);
-
-    action.createParam("language")
-      .setDescription("Profile language")
-      .setRequired(true)
-      .setExampleValue("java");
-    action.createParam("name")
-      .setDescription("Profile name")
-      .setRequired(true)
-      .setExampleValue("Sonar way");
-  }
 }
index 98ff19fbb6574f4168a0fa128d6828d637bf7162..2e826d693bbda4aac3fff8e5ef9669f27f77dc53 100644 (file)
@@ -46,7 +46,7 @@ public class ProfilesWsTest {
     assertThat(controller).isNotNull();
     assertThat(controller.path()).isEqualTo("api/profiles");
     assertThat(controller.description()).isNotEmpty();
-    assertThat(controller.actions()).hasSize(4);
+    assertThat(controller.actions()).hasSize(3);
   }
 
   @Test
@@ -79,14 +79,4 @@ public class ProfilesWsTest {
     assertThat(restoreProfiles.handler()).isInstanceOf(RailsHandler.class);
     assertThat(restoreProfiles.params()).hasSize(2);
   }
-
-  @Test
-  public void define_destroy_action() {
-    WebService.Controller controller = tester.controller("api/profiles");
-
-    WebService.Action restoreProfiles = controller.action("destroy");
-    assertThat(restoreProfiles).isNotNull();
-    assertThat(restoreProfiles.handler()).isInstanceOf(RailsHandler.class);
-    assertThat(restoreProfiles.params()).hasSize(2);
-  }
 }
index 1cb1f19a708ea5abc2187673fe8231e3e66d5c30..b19e00233e7718d60868fb766df2518a29ece97d 100644 (file)
@@ -21,20 +21,6 @@ require 'json'
 
 class Api::ProfilesController < Api::ApiController
 
-  # POST /api/profiles/destroy?language=<language>&name=<name>
-  def destroy
-    verify_post_request
-    access_denied unless has_role?(:profileadmin)
-    require_parameters :language, :name
-
-    call_backend do
-      profile = Internal.quality_profiles.profile(params[:name], params[:language])
-      not_found('Profile not found') unless profile
-      Internal.component(Java::OrgSonarServerQualityprofile::QProfileService.java_class).delete(profile.key)
-    end
-    render_success('Profile destroyed')
-  end
-
   # GET /api/profiles?language=<language>[&name=<name>]
   def index
     require_parameters :language