Class: Projects::Security::ConfigurationPresenter

Inherits:
Gitlab::View::Presenter::Delegated show all
Includes:
AutoDevopsHelper, Security::LatestPipelineInformation
Defined in:
app/presenters/projects/security/configuration_presenter.rb

Instance Method Summary collapse

Methods included from AutoDevopsHelper

#auto_devops_settings_path, #badge_for_auto_devops_scope, #show_auto_devops_callout?

Methods inherited from Gitlab::View::Presenter::Delegated

#initialize

Methods included from Gitlab::Utils::DelegatorOverride

#delegator_override, #delegator_override_with, #delegator_target, validator, validators, verify!

Methods included from Gitlab::View::Presenter::Base

#__subject__, #can?, #declarative_policy_delegate, #is_a?, #path_with_line_numbers, #present, #url_builder, #web_path, #web_url

Methods included from Gitlab::Allowable

#can?, #can_all?, #can_any?

Methods included from Gitlab::Routing

includes_helpers, redirect_legacy_paths, url_helpers

Constructor Details

This class inherits a constructor from Gitlab::View::Presenter::Delegated

Instance Method Details

#to_hObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/presenters/projects/security/configuration_presenter.rb', line 11

def to_h
  {
    auto_devops_enabled: auto_devops_source?,
    auto_devops_help_page_path: help_page_path('topics/autodevops/index.md'),
    auto_devops_path: auto_devops_settings_path(project),
    can_enable_auto_devops: can_enable_auto_devops?,
    features: features,
    help_page_path: help_page_path('user/application_security/index.md'),
    latest_pipeline_path: latest_pipeline_path,
    gitlab_ci_present: project.has_ci_config_file?,
    gitlab_ci_history_path: gitlab_ci_history_path,
    security_training_enabled: project.security_training_available?,
    container_scanning_for_registry_enabled: container_scanning_for_registry_enabled,
    pre_receive_secret_detection_available:
      Gitlab::CurrentSettings.current_application_settings.pre_receive_secret_detection_enabled,
    pre_receive_secret_detection_enabled: pre_receive_secret_detection_enabled,
    user_is_project_admin: user_is_project_admin?,
    secret_detection_configuration_path: secret_detection_configuration_path
  }
end

#to_html_data_attributeObject



32
33
34
35
36
37
# File 'app/presenters/projects/security/configuration_presenter.rb', line 32

def to_html_data_attribute
  data = to_h
  data[:features] = data[:features].to_json

  data
end