Revision 8a93d7c8
Added by Dominic Cleal over 7 years ago
app/controllers/interfaces_controller.rb | ||
---|---|---|
class InterfacesController < ApplicationController
|
||
include Foreman::Controller::Parameters::Host
|
||
|
||
# params structure is
|
||
# {"host"=>
|
||
# {"interfaces_attributes"=>
|
||
# {"new_1405068143746"=>
|
||
# {"1405068143746"=>
|
||
# {"_destroy"=>"false", "type"=>"Nic::BMC", "mac"=>"", "name"=>"", "domain_id"=>"", "ip"=>""}}}}
|
||
def new
|
||
@host = Host.new params[:host]
|
||
safe_params = host_params('host')
|
||
@host = Host.new(safe_params)
|
||
|
||
attributes = params[:host].fetch(:interfaces_attributes, {})
|
||
attributes = safe_params.fetch(:interfaces_attributes, {})
|
||
@key, attributes = attributes.first
|
||
raise Foreman::Exception, 'Missing attributes for interface' if @key.blank?
|
||
|
Also available in: Unified diff
fixes #17170 - use strong params in InterfacesController
(cherry picked from commit 93046b80ad54cfaecf37d14f701dda8613265b1a)