summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-07-13 18:03:52 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2017-07-27 11:49:27 +0200
commitea1012ccb4da9c8e0dae1a9cb710b39c97baa8a1 (patch)
treed40d07d77a3839bfccfdfa5a84e9063c5c0d4e18 /lib/api
parent2e483ca9e3cd2ff25d6ae0a69d2d9b5fcea7267c (diff)
downloadgitlab-ce-ea1012ccb4da9c8e0dae1a9cb710b39c97baa8a1.tar.gz
Make the attribute list for application settings reusable
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/entities.rb33
-rw-r--r--lib/api/settings.rb3
2 files changed, 4 insertions, 32 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 5cdc441e8cb..ce25be34ec4 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -671,43 +671,14 @@ module API
class ApplicationSetting < Grape::Entity
expose :id
- expose :default_projects_limit
- expose :signup_enabled
- expose :password_authentication_enabled
- expose :password_authentication_enabled, as: :signin_enabled
- expose :gravatar_enabled
- expose :sign_in_text
- expose :after_sign_up_text
- expose :created_at
- expose :updated_at
- expose :home_page_url
- expose :default_branch_protection
+ expose(*::ApplicationSettingsHelper.visible_attributes)
expose(:restricted_visibility_levels) do |setting, _options|
setting.restricted_visibility_levels.map { |level| Gitlab::VisibilityLevel.string_level(level) }
end
- expose :max_attachment_size
- expose :session_expire_delay
expose(:default_project_visibility) { |setting, _options| Gitlab::VisibilityLevel.string_level(setting.default_project_visibility) }
expose(:default_snippet_visibility) { |setting, _options| Gitlab::VisibilityLevel.string_level(setting.default_snippet_visibility) }
expose(:default_group_visibility) { |setting, _options| Gitlab::VisibilityLevel.string_level(setting.default_group_visibility) }
- expose :default_artifacts_expire_in
- expose :domain_whitelist
- expose :domain_blacklist_enabled
- expose :domain_blacklist
- expose :user_oauth_applications
- expose :after_sign_out_path
- expose :container_registry_token_expire_delay
- expose :repository_storage
- expose :repository_storages
- expose :koding_enabled
- expose :koding_url
- expose :plantuml_enabled
- expose :plantuml_url
- expose :terminal_max_session_time
- expose :polling_interval_multiplier
- expose :help_page_hide_commercial_content
- expose :help_page_text
- expose :help_page_support_url
+ expose :password_authentication_enabled, as: :signin_enabled
end
class Release < Grape::Entity
diff --git a/lib/api/settings.rb b/lib/api/settings.rb
index b19095d1252..ca21f3e6f4c 100644
--- a/lib/api/settings.rb
+++ b/lib/api/settings.rb
@@ -174,7 +174,8 @@ 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.'
- at_least_one_of(*at_least_one_of_ce)
+ optional(*::ApplicationSettingsHelper.visible_attributes)
+ at_least_one_of(*::ApplicationSettingsHelper.visible_attributes)
end
put "application/settings" do
attrs = declared_params(include_missing: false)