Sha256: a4b702719d469787fcd8c1e4af06ca60fc92ce6531df63e4c6c1b0c445faac6f

Contents?: true

Size: 1.11 KB

Versions: 6

Compression:

Stored size: 1.11 KB

Contents

module Katello
  module Concerns
    module Api::V2::HostsControllerExtensions
      extend ActiveSupport::Concern
      include ForemanTasks::Triggers

      module Overrides
        def action_permission
          case params[:action]
          when 'host_collections'
            'edit'
          else
            super
          end
        end
      end

      included do
        prepend Overrides
        def destroy
          Katello::RegistrationManager.unregister_host(@host, :unregistering => false)
          process_response(:object => @host)
        end

        api :PUT, "/hosts/:host_id/host_collections", N_("Alter a hosts host collections")
        param :host_id, :number, :required => true, :desc => N_("The id of the host to alter")
        param :host_collection_ids, Array, :required => true, :desc => N_("List of host collection ids to update")
        def host_collections
          @host.host_collection_ids = params[:host_collection_ids]
          @host.save!
          render(:locals => { :resource => @host }, :template => 'katello/api/v2/hosts/show', :status => :ok)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
katello-3.12.3 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.12.2 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.12.1 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.12.0 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.12.0.rc2 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.12.0.rc1 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb