From: Teryk Bellahsene Date: Fri, 2 Oct 2015 14:54:56 +0000 (+0200) Subject: SONAR-6311 Delete RoR WS api/profiles/destroy X-Git-Tag: 5.2-RC1~94 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5ae0faa33a29284b4cb3fec0af0db526e4302ea9;p=sonarqube.git SONAR-6311 Delete RoR WS api/profiles/destroy --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProfilesWs.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProfilesWs.java index 6d9df46f23d..dfae02a9327 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProfilesWs.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ProfilesWs.java @@ -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"); - } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProfilesWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProfilesWsTest.java index 98ff19fbb65..2e826d693bb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProfilesWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProfilesWsTest.java @@ -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); - } } diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/profiles_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/profiles_controller.rb index 1cb1f19a708..b19e00233e7 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/profiles_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/profiles_controller.rb @@ -21,20 +21,6 @@ require 'json' class Api::ProfilesController < Api::ApiController - # POST /api/profiles/destroy?language=&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=[&name=] def index require_parameters :language