summaryrefslogtreecommitdiff
path: root/app/helpers/ci_variables_helper.rb
diff options
context:
space:
mode:
authorAlexis Reigel <alexis.reigel.ext@siemens.com>2018-12-04 14:40:47 +0100
committerAlexis Reigel <alexis.reigel.ext@siemens.com>2018-12-04 16:35:04 +0100
commita648bcad7bb7fcf24c0be81abf273da8d0bbf410 (patch)
treed36d3a9b798815def15fa014a8df3a580c56d82d /app/helpers/ci_variables_helper.rb
parentccecf436abdca602e703e09f1017f4376263c1d9 (diff)
downloadgitlab-ce-a648bcad7bb7fcf24c0be81abf273da8d0bbf410.tar.gz
extract protected variable logic to helper
Diffstat (limited to 'app/helpers/ci_variables_helper.rb')
-rw-r--r--app/helpers/ci_variables_helper.rb15
1 files changed, 15 insertions, 0 deletions
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