Refactor API::Settings for EE

This refactors API::Settings so that EE can more easily extend its
behaviour, without having to modify the CE source code directly.
This commit is contained in:
Yorick Peterse 2019-03-01 16:27:43 +01:00
parent 3156db3293
commit 85f11eff9b
No known key found for this signature in database
GPG Key ID: EDD30D2BEB691AC9
1 changed files with 7 additions and 0 deletions

View File

@ -9,6 +9,11 @@ module API
@current_setting ||=
(ApplicationSetting.current_without_cache || ApplicationSetting.create_from_defaults)
end
def filter_attributes_using_license(attrs)
# This method will be redefined in EE.
attrs
end
end
desc 'Get the current application settings' do
@ -156,6 +161,8 @@ module API
attrs[:password_authentication_enabled_for_web] = attrs.delete(:password_authentication_enabled)
end
attrs = filter_attributes_using_license(attrs)
if ApplicationSettings::UpdateService.new(current_settings, current_user, attrs).execute
present current_settings, with: Entities::ApplicationSetting
else