Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #16002 - convert to strong params
- Loading branch information
Showing
24 changed files
with
115 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
app/controllers/concerns/foreman/controller/parameters/foreign_input_set.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module ::Foreman::Controller::Parameters::ForeignInputSet | ||
extend ActiveSupport::Concern | ||
|
||
class_methods do | ||
def foreign_input_set_params_filter | ||
Foreman::ParameterFilter.new(::ForeignInputSet).tap do |filter| | ||
filter.permit_by_context(:id, :_destroy, :template_id, :target_template_id, :include_all, :include, :exclude, | ||
:nested => true) | ||
end | ||
end | ||
end | ||
|
||
def foreign_input_set_params | ||
self.class.foreign_input_set_params_filter.filter_params(params, parameter_filter_context, :foreign_input_set) | ||
end | ||
end |
31 changes: 31 additions & 0 deletions
31
app/controllers/concerns/foreman/controller/parameters/job_template.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module Foreman::Controller::Parameters::JobTemplate | ||
extend ActiveSupport::Concern | ||
include Foreman::Controller::Parameters::Taxonomix | ||
include Foreman::Controller::Parameters::Template | ||
include Foreman::Controller::Parameters::TemplateInput | ||
include Foreman::Controller::Parameters::ForeignInputSet | ||
|
||
class_methods do | ||
def job_template_effective_user_filter | ||
Foreman::ParameterFilter.new(::JobTemplateEffectiveUser).tap do |filter| | ||
filter.permit_by_context(:value, :current_user, :overridable, | ||
:nested => true) | ||
end | ||
end | ||
|
||
def job_template_params_filter | ||
Foreman::ParameterFilter.new(::TemplateInput).tap do |filter| | ||
filter.permit :job_category, :provider_type, :description_format, | ||
:effective_user_attributes => [job_template_effective_user_filter], | ||
:template_inputs_attributes => [template_input_params_filter], | ||
:foreign_input_sets_attributes => [foreign_input_set_params_filter] | ||
add_template_params_filter(filter) | ||
add_taxonomix_params_filter(filter) | ||
end | ||
end | ||
end | ||
|
||
def job_template_params | ||
self.class.job_template_params_filter.filter_params(params, parameter_filter_context, :job_template) | ||
end | ||
end |
15 changes: 15 additions & 0 deletions
15
app/controllers/concerns/foreman/controller/parameters/remote_execution_feature.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module Foreman::Controller::Parameters::RemoteExecutionFeature | ||
extend ActiveSupport::Concern | ||
|
||
class_methods do | ||
def remote_execution_feature_params_filter | ||
::Foreman::ParameterFilter.new(::RemoteExecutionFeature).tap do |filter| | ||
filter.permit :label, :name, :provided_input_names, :description, :job_template_id | ||
end | ||
end | ||
end | ||
|
||
def remote_execution_feature_params | ||
self.class.remote_execution_feature_params_filter.filter_params(params, parameter_filter_context, :remote_execution_feature) | ||
end | ||
end |
11 changes: 11 additions & 0 deletions
11
app/controllers/concerns/foreman/controller/parameters/targeting.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module Foreman::Controller::Parameters::Targeting | ||
extend ActiveSupport::Concern | ||
|
||
class_methods do | ||
def targeting_params_filter | ||
Foreman::ParameterFilter.new(::Targeting).tap do |filter| | ||
filter.permit_by_context :targeting_type, :bookmark_id, :user, :search_query, :nested => true | ||
end | ||
end | ||
end | ||
end |
17 changes: 17 additions & 0 deletions
17
app/controllers/concerns/foreman/controller/parameters/template_input.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module Foreman::Controller::Parameters::TemplateInput | ||
extend ActiveSupport::Concern | ||
|
||
class_methods do | ||
def template_input_params_filter | ||
Foreman::ParameterFilter.new(::TemplateInput).tap do |filter| | ||
filter.permit_by_context :id, :_destroy, :name, :required, :input_type, :fact_name, | ||
:variable_name, :puppet_class_name, :puppet_parameter_name, :description, :template_id, | ||
:options, :advanced, :nested => true | ||
end | ||
end | ||
end | ||
|
||
def template_input_params | ||
self.class.template_input_params_filter.filter_params(params, parameter_filter_context, :template_input) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters