diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-13 03:08:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-13 03:08:46 +0300 |
commit | 47d1f417f03aca055b2ba49c32bb6fb01c459831 (patch) | |
tree | 200f05f28369cbf3a34abcb4a3c388558268b86f /lib/api/entities/application_setting.rb | |
parent | 006e89697dd5165f355afc20fc6bb0cdfa7b381a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api/entities/application_setting.rb')
-rw-r--r-- | lib/api/entities/application_setting.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/api/entities/application_setting.rb b/lib/api/entities/application_setting.rb new file mode 100644 index 00000000000..6ca2d1e6da4 --- /dev/null +++ b/lib/api/entities/application_setting.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +module API + module Entities + class ApplicationSetting < Grape::Entity + def self.exposed_attributes + attributes = ::ApplicationSettingsHelper.visible_attributes + attributes.delete(:performance_bar_allowed_group_path) + attributes.delete(:performance_bar_enabled) + attributes.delete(:allow_local_requests_from_hooks_and_services) + + # let's not expose the secret key in a response + attributes.delete(:asset_proxy_secret_key) + attributes.delete(:eks_secret_access_key) + + attributes + end + + expose :id, :performance_bar_allowed_group_id + expose(*exposed_attributes) + expose(:restricted_visibility_levels) do |setting, _options| + setting.restricted_visibility_levels.map { |level| Gitlab::VisibilityLevel.string_level(level) } + end + 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(*::ApplicationSettingsHelper.external_authorization_service_attributes) + + # support legacy names, can be removed in v5 + expose :password_authentication_enabled_for_web, as: :password_authentication_enabled + expose :password_authentication_enabled_for_web, as: :signin_enabled + expose :allow_local_requests_from_web_hooks_and_services, as: :allow_local_requests_from_hooks_and_services + end + end +end |