summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-09-01 19:23:08 +0000
committerRobert Speicher <robert@gitlab.com>2017-09-01 19:23:08 +0000
commit223849fa173b7059e717ba4f9c02075a452cbd49 (patch)
tree19dd9e840010234164a4461ac081889c07e05c9a /lib/api
parentdd825c0f5d00cef3cac89480bcf2027064c5d89d (diff)
parent29b40db58944a32db6cf1ae9906653a2e5f4be9d (diff)
downloadgitlab-ce-223849fa173b7059e717ba4f9c02075a452cbd49.tar.gz
Merge branch '17849-allow-admin-to-restrict-min-key-length-and-techno' into 'master'
Add settings for minimum key strength and allowed key type Closes #17849 See merge request !13712
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/settings.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/api/settings.rb b/lib/api/settings.rb
index 667ba468ce6..851b226e9e5 100644
--- a/lib/api/settings.rb
+++ b/lib/api/settings.rb
@@ -122,6 +122,13 @@ module API
optional :terminal_max_session_time, type: Integer, desc: 'Maximum time for web terminal websocket connection (in seconds). Set to 0 for unlimited time.'
optional :polling_interval_multiplier, type: BigDecimal, desc: 'Interval multiplier used by endpoints that perform polling. Set to 0 to disable polling.'
+ ApplicationSetting::SUPPORTED_KEY_TYPES.each do |type|
+ optional :"#{type}_key_restriction",
+ type: Integer,
+ values: KeyRestrictionValidator.supported_key_restrictions(type),
+ 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)
end