aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorDaniel Schwarz <daniel.schwarz@sonarsource.com>2017-04-28 17:43:38 +0200
committerDaniel Schwarz <bartfastiel@users.noreply.github.com>2017-05-03 09:39:14 +0200
commitcdbc593f739c6dd141fd9a9caca617b849ea69a1 (patch)
tree1ad5927f5df7136709f4859761ca803ce476ad15 /server
parent165b47c95a52c4da65210ca94703b2800fe8b272 (diff)
downloadsonarqube-cdbc593f739c6dd141fd9a9caca617b849ea69a1.tar.gz
sonarqube-cdbc593f739c6dd141fd9a9caca617b849ea69a1.zip
SONAR-9151 return visibility also for views in api/navigation/component
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentAction.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentAction.java b/server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentAction.java
index c4c47efdb60..82cebbd754c 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentAction.java
@@ -19,10 +19,12 @@
*/
package org.sonar.server.ui.ws;
+import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import java.util.Date;
import java.util.List;
import java.util.Optional;
+import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
@@ -77,6 +79,10 @@ public class ComponentAction implements NavigationWsAction {
private static final String PROPERTY_HAS_ROLE_POLICY = "hasRolePolicy";
private static final String PROPERTY_MODIFIABLE_HISTORY = "modifiable_history";
private static final String PROPERTY_UPDATABLE_KEY = "updatable_key";
+ /**
+ * The concept of "visibility" will only be configured for these qualifiers.
+ */
+ private static final Set<String> QUALIFIERS_WITH_VISIBILITY = ImmutableSet.of(Qualifiers.PROJECT, Qualifiers.VIEW);
private final DbClient dbClient;
private final PageRepository pageRepository;
@@ -169,7 +175,7 @@ public class ComponentAction implements NavigationWsAction {
.prop("name", component.name())
.prop("description", component.description())
.prop("isFavorite", isFavourite(session, component));
- if (Qualifiers.PROJECT.equals(component.qualifier())) {
+ if (QUALIFIERS_WITH_VISIBILITY.contains(component.qualifier())) {
json.prop("visibility", Visibility.getLabel(component.isPrivate()));
}
List<Page> pages = pageRepository.getComponentPages(false, component.qualifier());