]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-17096 Add system announcement settings
authorMathieu Suen <mathieu.suen@sonarsource.com>
Tue, 20 Sep 2022 12:34:41 +0000 (14:34 +0200)
committersonartech <sonartech@sonarsource.com>
Fri, 23 Sep 2022 07:56:36 +0000 (07:56 +0000)
sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java
sonar-core/src/main/resources/org/sonar/l10n/core.properties
sonar-core/src/test/java/org/sonar/core/config/CorePropertyDefinitionsTest.java

index 609fbf159c09827365de36180b096fe5ce5e86e6..985e312089585f942f6f0b6a1708fd775d15d3eb 100644 (file)
@@ -31,9 +31,7 @@ import org.sonar.api.resources.Qualifiers;
 import org.sonar.core.extension.PluginRiskConsent;
 
 import static java.util.Arrays.asList;
-import static org.sonar.api.PropertyType.BOOLEAN;
-import static org.sonar.api.PropertyType.SINGLE_SELECT_LIST;
-import static org.sonar.api.PropertyType.STRING;
+import static org.sonar.api.PropertyType.*;
 import static org.sonar.core.extension.PluginRiskConsent.NOT_ACCEPTED;
 
 public class CorePropertyDefinitions {
@@ -44,6 +42,10 @@ public class CorePropertyDefinitions {
 
   public static final String DISABLE_NOTIFICATION_ON_BUILT_IN_QPROFILES = "sonar.builtInQualityProfiles.disableNotificationOnUpdate";
 
+  public static final String SUB_SYSTEM_ANNOUNCEMENT = "announcement";
+  public static final String SYSTEM_ANNOUNCEMENT_MESSAGE = "sonar.systemAnnouncement.message";
+  public static final String SYSTEM_ANNOUNCEMENT_DISPLAY_MESSAGE = "sonar.systemAnnouncement.displayMessage";
+
   public static final String PLUGINS_RISK_CONSENT = "sonar.plugins.risk.consent";
 
   private CorePropertyDefinitions() {
@@ -69,7 +71,7 @@ public class CorePropertyDefinitions {
         .category(CoreProperties.CATEGORY_GENERAL)
         .subCategory(CoreProperties.SUBCATEGORY_MODULES)
         .onlyOnQualifiers(Qualifiers.PROJECT)
-        .type(PropertyType.TEXT)
+        .type(TEXT)
         .build(),
       PropertyDefinition.builder(CoreProperties.SERVER_BASE_URL)
         .name("Server base URL")
@@ -90,6 +92,21 @@ public class CorePropertyDefinitions {
         .defaultValue(String.valueOf(false))
         .hidden()
         .build(),
+      PropertyDefinition.builder(SYSTEM_ANNOUNCEMENT_MESSAGE)
+        .name("System announcement message")
+        .description("If \"Display system announcement message\" is set to True, this message will be displayed in a banner to all authenticate SonarQube users.")
+        .category(CoreProperties.CATEGORY_GENERAL)
+        .subCategory(SUB_SYSTEM_ANNOUNCEMENT)
+        .type(TEXT)
+        .build(),
+      PropertyDefinition.builder(SYSTEM_ANNOUNCEMENT_DISPLAY_MESSAGE)
+        .name("Display system announcement message")
+        .description("If set to True, the \"System announcement message\" will be displayed in a banner to all authenticate SonarQube users.")
+        .defaultValue(Boolean.toString(false))
+        .subCategory(SUB_SYSTEM_ANNOUNCEMENT)
+        .category(CoreProperties.CATEGORY_GENERAL)
+        .type(BOOLEAN)
+        .build(),
       PropertyDefinition.builder(DISABLE_NOTIFICATION_ON_BUILT_IN_QPROFILES)
         .name("Avoid quality profiles notification")
         .description("Avoid sending email notification on each update of built-in quality profiles to quality profile administrators.")
index b0ebf52877e11168bdf082ac4b8ca28ca363ca11..76a127bceed21cd19393ceec989b200cfe3ae7bd 100644 (file)
@@ -1314,6 +1314,7 @@ settings.pr_decoration.binding.form.bitbucketcloud.repository.help=The repositor
 settings.pr_decoration.binding.form.gitlab.repository=Project ID
 settings.pr_decoration.binding.form.gitlab.repository.help=The Project ID is a numerical unique identifier for your project. You can find it on your Project Overview.
 
+property.category.announcement=Annoucement
 property.category.general=General
 property.category.general.email=Email
 property.category.general.duplications=Duplications
index 00d1068c7a325c60c8ac6389f83ba7b3aa7d1680..ed3f949f5632be04c3b3c6fe39bd1d79e884ca96 100644 (file)
@@ -30,7 +30,7 @@ public class CorePropertyDefinitionsTest {
   @Test
   public void all() {
     List<PropertyDefinition> defs = CorePropertyDefinitions.all();
-    assertThat(defs).hasSize(52);
+    assertThat(defs).hasSize(54);
   }
 
   @Test