From c767a191af48e919aa5bcb40e80e15ae80a47595 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Lesaint?= Date: Mon, 11 Jan 2016 12:47:19 +0100 Subject: [PATCH] SONAR-6283 add missing required permission to Profiles WS descriptions --- .../sonar/server/qualityprofile/ws/ChangeParentAction.java | 2 +- .../java/org/sonar/server/qualityprofile/ws/CopyAction.java | 2 +- .../org/sonar/server/qualityprofile/ws/CreateAction.java | 2 +- .../org/sonar/server/qualityprofile/ws/DeleteAction.java | 5 ++--- .../org/sonar/server/qualityprofile/ws/OldRestoreAction.java | 5 +++-- .../org/sonar/server/qualityprofile/ws/RenameAction.java | 2 +- .../org/sonar/server/qualityprofile/ws/RestoreAction.java | 5 +++-- .../org/sonar/server/qualityprofile/ws/SetDefaultAction.java | 2 +- 8 files changed, 13 insertions(+), 12 deletions(-) diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ChangeParentAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ChangeParentAction.java index ef2fa997f8c..c9758089dc4 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ChangeParentAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/ChangeParentAction.java @@ -70,7 +70,7 @@ public class ChangeParentAction implements QProfileWsAction { inheritance.createParam(PARAM_PARENT_KEY) .setDescription("The key of the new parent profile. If this parameter is set, parentName must not be set. " + "If both are left empty, the inheritance link with current parent profile (if any) is broken, which deactivates all rules " + - "which come from the parent and are not overridden.") + "which come from the parent and are not overridden. Require Administer Quality Profiles permission.") .setExampleValue("sonar-way-java-12345"); inheritance.createParam(PARAM_PARENT_NAME) .setDescription("A quality profile name. If this parameter is set, profileKey must not be set and language must be set to disambiguate.") diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CopyAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CopyAction.java index bfb0271cdeb..168a31446cd 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CopyAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CopyAction.java @@ -49,7 +49,7 @@ public class CopyAction implements QProfileWsAction { public void define(WebService.NewController controller) { NewAction setDefault = controller.createAction("copy") .setSince("5.2") - .setDescription("Copy a quality profile.") + .setDescription("Copy a quality profile. Require Administer Quality Profiles permission.") .setPost(true) .setHandler(this); diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CreateAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CreateAction.java index b1e23f9f979..cb1ab9d31fa 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CreateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CreateAction.java @@ -76,7 +76,7 @@ public class CreateAction implements QProfileWsAction { public void define(WebService.NewController controller) { NewAction create = controller.createAction("create") .setSince("5.2") - .setDescription("Create a quality profile.") + .setDescription("Create a quality profile. Require Administer Quality Profiles permission.") .setPost(true) .setResponseExample(getClass().getResource("example-create.json")) .setHandler(this); diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/DeleteAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/DeleteAction.java index e4f1e8f0a96..75ddc8cb8ae 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/DeleteAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/DeleteAction.java @@ -47,7 +47,8 @@ public class DeleteAction implements QProfileWsAction { @Override public void define(NewController controller) { NewAction action = controller.createAction("delete") - .setDescription("Delete a quality profile and all its descendants. The default quality profile cannot be deleted.") + .setDescription("Delete a quality profile and all its descendants. The default quality profile cannot be deleted. " + + "Require Administer Quality Profiles permission.") .setSince("5.2") .setPost(true) .setHandler(this); @@ -55,13 +56,11 @@ public class DeleteAction implements QProfileWsAction { QProfileIdentificationParamUtils.defineProfileParams(action, languages); } - @Override public void handle(Request request, Response response) throws Exception { userSession.checkLoggedIn(); userSession.checkPermission(GlobalPermissions.QUALITY_PROFILE_ADMIN); - DbSession session = dbClient.openSession(false); try { String profileKey = QProfileIdentificationParamUtils.getProfileKeyFromParameters(request, profileFactory, session); diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/OldRestoreAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/OldRestoreAction.java index 63c9acfe154..f710a477e32 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/OldRestoreAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/OldRestoreAction.java @@ -59,8 +59,9 @@ public class OldRestoreAction implements WsAction { public void define(WebService.NewController controller) { controller.createAction("restore") .setSince("5.2") - .setDescription("Restore a quality profile using an XML file. The restored profile name is taken from the backup file, " - + "so if a profile with the same name and language already exists, it will be overwritten.") + .setDescription("Restore a quality profile using an XML file. The restored profile name is taken from the backup file, " + + "so if a profile with the same name and language already exists, it will be overwritten. " + + "Require Administer Quality Profiles permission.") .setPost(true) .setInternal(true) .setHandler(this) diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RenameAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RenameAction.java index 625db6ea8bf..943fb562b9a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RenameAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RenameAction.java @@ -44,7 +44,7 @@ public class RenameAction implements QProfileWsAction { public void define(WebService.NewController controller) { NewAction setDefault = controller.createAction("rename") .setSince("5.2") - .setDescription("Rename a quality profile.") + .setDescription("Rename a quality profile. Require Administer Quality Profiles permission.") .setPost(true) .setHandler(this); diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RestoreAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RestoreAction.java index 4b0c62272b8..9531a911fca 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RestoreAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/RestoreAction.java @@ -53,8 +53,9 @@ public class RestoreAction implements QProfileWsAction { public void define(WebService.NewController controller) { controller.createAction("restore") .setSince("5.2") - .setDescription("Restore a quality profile using an XML file. The restored profile name is taken from the backup file, " - + "so if a profile with the same name and language already exists, it will be overwritten.") + .setDescription("Restore a quality profile using an XML file. The restored profile name is taken from the backup file, " + + "so if a profile with the same name and language already exists, it will be overwritten. " + + "Require Administer Quality Profiles permission.") .setPost(true) .setHandler(this) .createParam(PARAM_BACKUP) diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SetDefaultAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SetDefaultAction.java index 40e173f2bad..34ed8959953 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SetDefaultAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SetDefaultAction.java @@ -59,7 +59,7 @@ public class SetDefaultAction implements QProfileWsAction { public void define(WebService.NewController controller) { NewAction setDefault = controller.createAction("set_default") .setSince("5.2") - .setDescription("Select the default profile for a given language.") + .setDescription("Select the default profile for a given language. Require Administer Quality Profiles permission.") .setPost(true) .setHandler(this); -- 2.39.5