summaryrefslogtreecommitdiff
path: root/lib/api/settings.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-05-29 15:42:59 +0000
committerDouwe Maan <douwe@gitlab.com>2018-05-29 15:42:59 +0000
commite79f91df8c2a38238ebe5c76862d2f35307bb7f5 (patch)
tree14f6370b8a79f4cf6de1652f763da9fbd49f6faf /lib/api/settings.rb
parent58c50d40524e0b0c23d4c5d7782583e3742047ba (diff)
parent1c5106fadfe59ec4af7235b94d424e4367185c2e (diff)
downloadgitlab-ce-e79f91df8c2a38238ebe5c76862d2f35307bb7f5.tar.gz
Merge branch '46758-fallout-of-cacheable-attribute' into 'master'
Ensure ApplicationSetting#performance_bar_allowed_group_id is properly set when retrieved from cache Closes #46758 See merge request gitlab-org/gitlab-ce!19144
Diffstat (limited to 'lib/api/settings.rb')
-rw-r--r--lib/api/settings.rb20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/api/settings.rb b/lib/api/settings.rb
index d727ad59367..4b506127c0e 100644
--- a/lib/api/settings.rb
+++ b/lib/api/settings.rb
@@ -49,6 +49,9 @@ module API
optional :signin_enabled, type: Boolean, desc: 'Flag indicating if password authentication is enabled for the web interface' # support legacy names, can be removed in v5
mutually_exclusive :password_authentication_enabled_for_web, :password_authentication_enabled, :signin_enabled
optional :password_authentication_enabled_for_git, type: Boolean, desc: 'Flag indicating if password authentication is enabled for Git over HTTP(S)'
+ optional :performance_bar_allowed_group_path, type: String, desc: 'Path of the group that is allowed to toggle the performance bar.'
+ optional :performance_bar_allowed_group_id, type: String, desc: 'Depreated: Use :performance_bar_allowed_group_path instead. Path of the group that is allowed to toggle the performance bar.' # support legacy names, can be removed in v6
+ optional :performance_bar_enabled, type: String, desc: 'Deprecated: Pass `performance_bar_allowed_group_path: nil` instead. Allow enabling the performance.' # support legacy names, can be removed in v6
optional :require_two_factor_authentication, type: Boolean, desc: 'Require all users to setup Two-factor authentication'
given require_two_factor_authentication: ->(val) { val } do
requires :two_factor_grace_period, type: Integer, desc: 'Amount of time (in hours) that users are allowed to skip forced configuration of two-factor authentication'
@@ -134,12 +137,25 @@ module API
desc: "Restrictions on the complexity of uploaded #{type.upcase} keys. A value of #{ApplicationSetting::FORBIDDEN_KEY_VALUE} disables all #{type.upcase} keys."
end
- optional(*::ApplicationSettingsHelper.visible_attributes)
- at_least_one_of(*::ApplicationSettingsHelper.visible_attributes)
+ optional_attributes = ::ApplicationSettingsHelper.visible_attributes << :performance_bar_allowed_group_id
+
+ optional(*optional_attributes)
+ at_least_one_of(*optional_attributes)
end
put "application/settings" do
attrs = declared_params(include_missing: false)
+ # support legacy names, can be removed in v6
+ if attrs.has_key?(:performance_bar_allowed_group_id)
+ attrs[:performance_bar_allowed_group_path] = attrs.delete(:performance_bar_allowed_group_id)
+ end
+
+ # support legacy names, can be removed in v6
+ if attrs.has_key?(:performance_bar_enabled)
+ performance_bar_enabled = attrs.delete(:performance_bar_allowed_group_id)
+ attrs[:performance_bar_allowed_group_path] = nil unless performance_bar_enabled
+ end
+
# support legacy names, can be removed in v5
if attrs.has_key?(:signin_enabled)
attrs[:password_authentication_enabled_for_web] = attrs.delete(:signin_enabled)