aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2016-01-08 12:44:34 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2016-01-12 15:34:25 +0100
commit51f2544c13d2e857153724337046075cea6df595 (patch)
treef1ced59d8bd9b39190b84a1d6c1a0e137f5f470a /sonar-db
parent08e697e6a8e0f13d0c38961e24d9136eba032a12 (diff)
downloadsonarqube-51f2544c13d2e857153724337046075cea6df595.tar.gz
sonarqube-51f2544c13d2e857153724337046075cea6df595.zip
SONAR-7174 "Execute Analysis" is now also a project permission
Diffstat (limited to 'sonar-db')
-rw-r--r--sonar-db/src/main/java/org/sonar/core/permission/ProjectPermissions.java13
-rw-r--r--sonar-db/src/test/java/org/sonar/core/permission/ProjectPermissionsTest.java38
2 files changed, 45 insertions, 6 deletions
diff --git a/sonar-db/src/main/java/org/sonar/core/permission/ProjectPermissions.java b/sonar-db/src/main/java/org/sonar/core/permission/ProjectPermissions.java
index 0db669d7069..0d46709d912 100644
--- a/sonar-db/src/main/java/org/sonar/core/permission/ProjectPermissions.java
+++ b/sonar-db/src/main/java/org/sonar/core/permission/ProjectPermissions.java
@@ -30,13 +30,14 @@ import org.sonar.api.web.UserRole;
*/
public final class ProjectPermissions {
- private ProjectPermissions() {
- // static constants only
- }
-
/**
- * All the component permissions values, ordered from {@link UserRole#USER} to {@link UserRole#CODEVIEWER}.
+ * All the component permissions values, ordered from {@link UserRole#USER} to {@link GlobalPermissions#SCAN_EXECUTION}.
*/
- public static final List<String> ALL = ImmutableList.of(UserRole.USER, UserRole.ADMIN, UserRole.ISSUE_ADMIN, UserRole.CODEVIEWER);
+ public static final List<String> ALL = ImmutableList.of(UserRole.USER, UserRole.ADMIN, UserRole.ISSUE_ADMIN, UserRole.CODEVIEWER, GlobalPermissions.SCAN_EXECUTION);
+
public static final String ALL_ON_ONE_LINE = Joiner.on(", ").join(ProjectPermissions.ALL);
+
+ private ProjectPermissions() {
+ // static constants only
+ }
}
diff --git a/sonar-db/src/test/java/org/sonar/core/permission/ProjectPermissionsTest.java b/sonar-db/src/test/java/org/sonar/core/permission/ProjectPermissionsTest.java
new file mode 100644
index 00000000000..7b5d6465924
--- /dev/null
+++ b/sonar-db/src/test/java/org/sonar/core/permission/ProjectPermissionsTest.java
@@ -0,0 +1,38 @@
+/*
+ * SonarQube :: Database
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact 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.permission;
+
+import org.junit.Test;
+import org.sonar.api.web.UserRole;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class ProjectPermissionsTest {
+
+ @Test
+ public void all_permissions() throws Exception {
+ assertThat(ProjectPermissions.ALL).containsOnly(UserRole.USER, UserRole.ADMIN, UserRole.ISSUE_ADMIN, UserRole.CODEVIEWER, GlobalPermissions.SCAN_EXECUTION);
+ }
+
+ @Test
+ public void all_permissions_as_string() throws Exception {
+ assertThat(ProjectPermissions.ALL_ON_ONE_LINE).isEqualTo("user, admin, issueadmin, codeviewer, scan");
+ }
+}