diff options
author | Daniel Schwarz <daniel.schwarz@sonarsource.com> | 2017-04-28 17:43:38 +0200 |
---|---|---|
committer | Daniel Schwarz <bartfastiel@users.noreply.github.com> | 2017-05-03 09:39:14 +0200 |
commit | cdbc593f739c6dd141fd9a9caca617b849ea69a1 (patch) | |
tree | 1ad5927f5df7136709f4859761ca803ce476ad15 /server | |
parent | 165b47c95a52c4da65210ca94703b2800fe8b272 (diff) | |
download | sonarqube-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.java | 8 |
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()); |