Sha256: 29deb23cf0e34dd51329198ca8ab70a819ecb20c4c9d586996814efa954f2b01

Contents?: true

Size: 757 Bytes

Versions: 16

Compression:

Stored size: 757 Bytes

Contents

module Foreman::Controller::Parameters::OvalContent
  extend ActiveSupport::Concern

  class_methods do
    def oval_content_params_filter
      Foreman::ParameterFilter.new(::ForemanOpenscap::OvalContent).tap do |filter|
        filter.permit :original_filename, :scap_file, :name, :url, :location_ids => [], :organization_ids => []
      end
    end
  end

  def oval_content_params
    read_file_content self.class.oval_content_params_filter.filter_params(params, parameter_filter_context)
  end

  def read_file_content(params)
    return params unless file = params[:scap_file]
    content = file.read
    filename = file.original_filename
    params.merge(:scap_file => content, :original_filename => params[:original_filename] || filename)
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
foreman_openscap-8.0.0 app/controllers/concerns/foreman/controller/parameters/oval_content.rb
foreman_openscap-7.1.1 app/controllers/concerns/foreman/controller/parameters/oval_content.rb
foreman_openscap-7.1.0 app/controllers/concerns/foreman/controller/parameters/oval_content.rb
foreman_openscap-7.0.0 app/controllers/concerns/foreman/controller/parameters/oval_content.rb
foreman_openscap-6.0.0 app/controllers/concerns/foreman/controller/parameters/oval_content.rb
foreman_openscap-5.2.3 app/controllers/concerns/foreman/controller/parameters/oval_content.rb
foreman_openscap-5.2.2 app/controllers/concerns/foreman/controller/parameters/oval_content.rb
foreman_openscap-5.1.1 app/controllers/concerns/foreman/controller/parameters/oval_content.rb
foreman_openscap-5.2.1 app/controllers/concerns/foreman/controller/parameters/oval_content.rb
foreman_openscap-5.2.0 app/controllers/concerns/foreman/controller/parameters/oval_content.rb
foreman_openscap-5.1.0 app/controllers/concerns/foreman/controller/parameters/oval_content.rb
foreman_openscap-5.0.0 app/controllers/concerns/foreman/controller/parameters/oval_content.rb
foreman_openscap-4.3.3 app/controllers/concerns/foreman/controller/parameters/oval_content.rb
foreman_openscap-4.3.2 app/controllers/concerns/foreman/controller/parameters/oval_content.rb
foreman_openscap-4.3.1 app/controllers/concerns/foreman/controller/parameters/oval_content.rb
foreman_openscap-4.3.0 app/controllers/concerns/foreman/controller/parameters/oval_content.rb