Sha256: 48765646515103a405003c9da6005533ba1a53a4a8e15b1c8a27d22a3991aebd
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
module ForemanCockpit # Controller methods to load Cockpit components module HostsControllerExtensions extend ActiveSupport::Concern included do before_filter :allow_cockpit_iframe, :only => :show end ForemanCockpit::COCKPIT_ACTIONS.each do |action| define_method(action) do # We can't add a before_filter :find_resource for Cockpit actions as # it'll override the default find_resource filter. find_resource suburl = ForemanCockpit::COCKPIT_SUBURL[action.to_sym] render :partial => 'foreman_cockpit/hosts/cockpit', :locals => { :fqdn => @host.fqdn, :suburl => suburl, :protocol => cockpit_protocol } end end private def allow_cockpit_iframe response.headers['Content-Security-Policy']. sub!("frame-src 'self'", "frame-src 'self' #{cockpit_protocol}://#{@host.fqdn}:9090") end def action_permission case params[:action] when *ForemanCockpit::COCKPIT_ACTIONS :console else super end end def cockpit_protocol require_ssl? ? 'https' : 'http' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
foreman_cockpit-1.0.2 | app/controllers/concerns/foreman_cockpit/hosts_controller_extensions.rb |