debian-mirror-gitlab/app/services/groups/base_service.rb

32 lines
726 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2016-06-02 11:05:42 +05:30
module Groups
class BaseService < ::BaseService
attr_accessor :group, :current_user, :params
def initialize(group, user, params = {})
2021-04-29 21:17:54 +05:30
@group = group
@current_user = user
@params = params.dup
2016-06-02 11:05:42 +05:30
end
2019-07-07 11:18:12 +05:30
private
2021-04-29 21:17:54 +05:30
def handle_namespace_settings
2022-08-13 15:12:31 +05:30
settings_params = params.slice(*::NamespaceSetting.allowed_namespace_settings_params)
2021-04-29 21:17:54 +05:30
return if settings_params.empty?
2022-08-13 15:12:31 +05:30
::NamespaceSetting.allowed_namespace_settings_params.each do |nsp|
2021-04-29 21:17:54 +05:30
params.delete(nsp)
end
::NamespaceSettings::UpdateService.new(current_user, group, settings_params).execute
end
2019-07-07 11:18:12 +05:30
def remove_unallowed_params
# overridden in EE
end
2016-06-02 11:05:42 +05:30
end
end