diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-13 15:08:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-13 15:08:49 +0300 |
commit | 988424215cf104d9ee24bb1751141424cffb32d1 (patch) | |
tree | 9d2525571ecc693902b949ac8441e8c97b299c3c /app/serializers | |
parent | 2705a15deaef07b1a38a53b9539d02f8ad499ce3 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/cluster_entity.rb | 10 | ||||
-rw-r--r-- | app/serializers/environment_entity.rb | 3 |
2 files changed, 10 insertions, 3 deletions
diff --git a/app/serializers/cluster_entity.rb b/app/serializers/cluster_entity.rb index e2d24e74b29..df72a994143 100644 --- a/app/serializers/cluster_entity.rb +++ b/app/serializers/cluster_entity.rb @@ -19,7 +19,7 @@ class ClusterEntity < Grape::Entity Clusters::ClusterPresenter.new(cluster).show_path # rubocop: disable CodeReuse/Presenter end - expose :gitlab_managed_apps_logs_path do |cluster| + expose :gitlab_managed_apps_logs_path, if: -> (*) { logging_enabled? } do |cluster| Clusters::ClusterPresenter.new(cluster, current_user: request.current_user).gitlab_managed_apps_logs_path # rubocop: disable CodeReuse/Presenter end @@ -27,7 +27,13 @@ class ClusterEntity < Grape::Entity Clusters::KubernetesErrorEntity.new(cluster) end - expose :enable_advanced_logs_querying do |cluster| + expose :enable_advanced_logs_querying, if: -> (*) { logging_enabled? } do |cluster| cluster.elastic_stack_available? end + + private + + def logging_enabled? + Feature.enabled?(:monitor_logging, object.project) + end end diff --git a/app/serializers/environment_entity.rb b/app/serializers/environment_entity.rb index 634be365a9d..ac99463bd64 100644 --- a/app/serializers/environment_entity.rb +++ b/app/serializers/environment_entity.rb @@ -103,7 +103,8 @@ class EnvironmentEntity < Grape::Entity end def can_read_pod_logs? - can?(current_user, :read_pod_logs, environment.project) + Feature.enabled?(:monitor_logging, environment.project) && + can?(current_user, :read_pod_logs, environment.project) end def can_read_deploy_board? |