diff options
author | Roger Rüttimann <roger.ruettimann@gmail.com> | 2018-08-30 12:53:06 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-08-30 12:53:06 +0000 |
commit | 93b9bfd93a841b7f86e6aeab3f9c5e9ede3a4503 (patch) | |
tree | 8bfec898a33d9b0b1693e73ce27a61db54881a66 /app/models/application_setting.rb | |
parent | 3113fb848001fdea3a039295002d7752b0feebbb (diff) | |
download | gitlab-ce-93b9bfd93a841b7f86e6aeab3f9c5e9ede3a4503.tar.gz |
Allow whitelisting for "external collaborator by default" setting
Diffstat (limited to 'app/models/application_setting.rb')
-rw-r--r-- | app/models/application_setting.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index c77faa4b71d..03bd7fa016e 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -192,6 +192,8 @@ class ApplicationSetting < ActiveRecord::Base numericality: { less_than_or_equal_to: :gitaly_timeout_default }, if: :gitaly_timeout_default + validates :user_default_internal_regex, js_regex: true, allow_nil: true + SUPPORTED_KEY_TYPES.each do |type| validates :"#{type}_key_restriction", presence: true, key_restriction: { type: type } end @@ -299,6 +301,7 @@ class ApplicationSetting < ActiveRecord::Base usage_ping_enabled: Settings.gitlab['usage_ping_enabled'], instance_statistics_visibility_private: false, user_default_external: false, + user_default_internal_regex: nil, user_show_add_ssh_key_message: true } end @@ -435,6 +438,14 @@ class ApplicationSetting < ActiveRecord::Base password_authentication_enabled_for_web? || password_authentication_enabled_for_git? end + def user_default_internal_regex_enabled? + user_default_external? && user_default_internal_regex.present? + end + + def user_default_internal_regex_instance + Regexp.new(user_default_internal_regex, Regexp::IGNORECASE) + end + delegate :terms, to: :latest_terms, allow_nil: true def latest_terms @latest_terms ||= Term.latest |