Sha256: 8ecf016b18270075d13fe3efd608779685359e13252836127b8948c3679e1f9d

Contents?: true

Size: 1.11 KB

Versions: 28

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 => 200)
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
katello-3.11.2 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.10.2 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.10.1.1 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.10.1 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.11.1 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.11.0 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.11.0.rc2 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.11.0.rc1 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.10.0 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.10.0.rc1.1 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.9.1 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.10.0.rc1 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.9.0 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.8.1 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.9.0.rc2 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.9.0.rc1 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.7.1.1 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.7.1 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.8.0 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.8.0.rc3 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb