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 {
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
}
.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)
--- /dev/null
+/*
+ * 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
+}