Commit f8454f38 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'rc/introduce-a-new-ee-service_params-module' into 'master'

Introduce a new EE::ServiceParams module

See merge request gitlab-org/gitlab-ee!3321
parents 9a7fc97b 6896e156
module ServiceParams
extend ActiveSupport::Concern
prepend EE::ServiceParams
ALLOWED_PARAMS_CE = [
:active,
......@@ -62,19 +63,12 @@ module ServiceParams
:webhook
].freeze
ALLOWED_PARAMS_EE = [
:jenkins_url,
:multiproject_enabled,
:pass_unstable,
:project_name
].freeze
# Parameters to ignore if no value is specified
FILTER_BLANK_PARAMS = [:password].freeze
def service_params
dynamic_params = @service.event_channel_names + @service.event_names
service_params = params.permit(:id, service: ALLOWED_PARAMS_CE + ALLOWED_PARAMS_EE + dynamic_params)
service_params = params.permit(:id, service: allowed_service_params + dynamic_params)
if service_params[:service].is_a?(Hash)
FILTER_BLANK_PARAMS.each do |param|
......@@ -84,4 +78,8 @@ module ServiceParams
service_params
end
def allowed_service_params
ALLOWED_PARAMS_CE
end
end
module EE
module ServiceParams
ALLOWED_PARAMS_EE = [
:jenkins_url,
:multiproject_enabled,
:pass_unstable,
:project_name
].freeze
def allowed_service_params
super + ALLOWED_PARAMS_EE
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment