diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-12-21 15:19:23 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-12-21 15:19:23 +0300 |
commit | 6749ef30b3484625de573ecf1709d34b4176421d (patch) | |
tree | 723cd57836c6d59a3ca28be189cb6567e6cec1d8 /app/helpers | |
parent | 7f334fdfafd5ea8a1c4277dcf4b1cb56e79c529b (diff) | |
parent | c111e2657df22c811191135369d599923dc89f54 (diff) |
Merge branch 'feature/option-to-make-variables-protected' into 'master'
Option to make variables protected by default
Closes #51822
See merge request gitlab-org/gitlab-ce!22744
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_settings_helper.rb | 3 | ||||
-rw-r--r-- | app/helpers/ci_variables_helper.rb | 15 |
2 files changed, 17 insertions, 1 deletions
diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb index 086bb38ce9a..72731d969a2 100644 --- a/app/helpers/application_settings_helper.rb +++ b/app/helpers/application_settings_helper.rb @@ -218,7 +218,8 @@ module ApplicationSettingsHelper :version_check_enabled, :web_ide_clientside_preview_enabled, :diff_max_patch_bytes, - :commit_email_hostname + :commit_email_hostname, + :protected_ci_variables ] end diff --git a/app/helpers/ci_variables_helper.rb b/app/helpers/ci_variables_helper.rb new file mode 100644 index 00000000000..e3728804c2a --- /dev/null +++ b/app/helpers/ci_variables_helper.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module CiVariablesHelper + def ci_variable_protected_by_default? + Gitlab::CurrentSettings.current_application_settings.protected_ci_variables + end + + def ci_variable_protected?(variable, only_key_value) + if variable && !only_key_value + variable.protected + else + ci_variable_protected_by_default? + end + end +end |