diff options
author | Jacek <jacek.poreda@sonarsource.com> | 2021-03-22 10:09:08 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2021-04-15 20:03:44 +0000 |
commit | f88ba04de0b4731b8cc7688585b1b58c0679a188 (patch) | |
tree | c35af3366917b75c609e8ad6909b81c17e8332c5 /sonar-core | |
parent | 3fb933500516153bcc2b0f036507a68badb638cb (diff) | |
download | sonarqube-f88ba04de0b4731b8cc7688585b1b58c0679a188.tar.gz sonarqube-f88ba04de0b4731b8cc7688585b1b58c0679a188.zip |
SONAR-14606 Add 'sonar.plugins.risk.consent' property
Diffstat (limited to 'sonar-core')
-rw-r--r-- | sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java | 19 | ||||
-rw-r--r-- | sonar-core/src/main/java/org/sonar/core/extension/PluginRiskConsent.java | 26 |
2 files changed, 43 insertions, 2 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java b/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java index 77e216a3fd0..26532c6bc5d 100644 --- a/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java +++ b/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java @@ -20,16 +20,21 @@ package org.sonar.core.config; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; import org.sonar.api.CoreProperties; import org.sonar.api.PropertyType; import org.sonar.api.config.EmailSettings; import org.sonar.api.config.PropertyDefinition; 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.core.extension.PluginRiskConsent.NOT_ACCEPTED; public class CorePropertyDefinitions { @@ -39,15 +44,17 @@ public class CorePropertyDefinitions { private static final String CATEGORY_ORGANIZATIONS = "organizations"; - //TODO remove + // TODO remove @Deprecated public static final String ORGANIZATIONS_ANYONE_CAN_CREATE = "sonar.organizations.anyoneCanCreate"; - //TODO remove + // TODO remove @Deprecated public static final String ORGANIZATIONS_CREATE_PERSONAL_ORG = "sonar.organizations.createPersonalOrg"; public static final String DISABLE_NOTIFICATION_ON_BUILT_IN_QPROFILES = "sonar.builtInQualityProfiles.disableNotificationOnUpdate"; + public static final String PLUGINS_RISK_CONSENT = "sonar.plugins.risk.consent"; + private CorePropertyDefinitions() { // only static stuff } @@ -100,6 +107,14 @@ public class CorePropertyDefinitions { .category(CoreProperties.CATEGORY_GENERAL) .type(BOOLEAN) .build(), + PropertyDefinition.builder(PLUGINS_RISK_CONSENT) + .name("State of user plugins risk consent") + .description("Determine whether user is required to accept plugins risk consent") + .defaultValue(NOT_ACCEPTED.name()) + .options(Arrays.stream(PluginRiskConsent.values()).map(Enum::name).collect(Collectors.toList())) + .hidden() + .type(SINGLE_SELECT_LIST) + .build(), // WEB LOOK&FEEL PropertyDefinition.builder(WebConstants.SONAR_LF_LOGO_URL) diff --git a/sonar-core/src/main/java/org/sonar/core/extension/PluginRiskConsent.java b/sonar-core/src/main/java/org/sonar/core/extension/PluginRiskConsent.java new file mode 100644 index 00000000000..80d976bec2d --- /dev/null +++ b/sonar-core/src/main/java/org/sonar/core/extension/PluginRiskConsent.java @@ -0,0 +1,26 @@ +/* + * SonarQube + * Copyright (C) 2009-2021 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.core.extension; + +public enum PluginRiskConsent { + NOT_ACCEPTED, + REQUIRED, + ACCEPTED +} |