aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/projectbranch/ws/ListAction.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/setting/ws/ValuesAction.java5
2 files changed, 7 insertions, 2 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/projectbranch/ws/ListAction.java b/server/sonar-server/src/main/java/org/sonar/server/projectbranch/ws/ListAction.java
index 53a3199b341..cc1023cbfc7 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/projectbranch/ws/ListAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/projectbranch/ws/ListAction.java
@@ -39,6 +39,7 @@ import org.sonar.db.component.ComponentDto;
import org.sonar.db.component.SnapshotDto;
import org.sonar.db.measure.MeasureDto;
import org.sonar.db.metric.MetricDto;
+import org.sonar.db.permission.OrganizationPermission;
import org.sonar.server.component.ComponentFinder;
import org.sonar.server.issue.index.BranchStatistics;
import org.sonar.server.issue.index.IssueIndex;
@@ -164,7 +165,8 @@ public class ListAction implements BranchWsAction {
private void checkPermission(ComponentDto component) {
if (!userSession.hasComponentPermission(UserRole.USER, component) &&
- !userSession.hasComponentPermission(SCAN_EXECUTION, component)) {
+ !userSession.hasComponentPermission(SCAN_EXECUTION, component) &&
+ !userSession.hasPermission(OrganizationPermission.SCAN, component.getOrganizationUuid())) {
throw insufficientPrivilegesException();
}
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/setting/ws/ValuesAction.java b/server/sonar-server/src/main/java/org/sonar/server/setting/ws/ValuesAction.java
index 2225743c0a4..863ddd27410 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/setting/ws/ValuesAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/setting/ws/ValuesAction.java
@@ -38,6 +38,7 @@ import org.sonar.api.server.ws.WebService;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.component.ComponentDto;
+import org.sonar.db.permission.OrganizationPermission;
import org.sonar.server.component.ComponentFinder;
import org.sonar.server.user.UserSession;
import org.sonarqube.ws.Settings;
@@ -152,7 +153,9 @@ public class ValuesAction implements SettingsWsAction {
return Optional.empty();
}
ComponentDto component = componentFinder.getByKeyAndOptionalBranch(dbSession, componentKey, valuesRequest.getBranch());
- if (!userSession.hasComponentPermission(USER, component) && !userSession.hasComponentPermission(SCAN_EXECUTION, component)) {
+ if (!userSession.hasComponentPermission(USER, component) &&
+ !userSession.hasComponentPermission(SCAN_EXECUTION, component) &&
+ !userSession.hasPermission(OrganizationPermission.SCAN, component.getOrganizationUuid())) {
throw insufficientPrivilegesException();
}
return Optional.of(component);