Sha256: 2d2d8e44006e64c7221586bdb544f8c8ae5de0ed629eb15e15f1602d4a6f7ffa

Contents?: true

Size: 732 Bytes

Versions: 16

Compression:

Stored size: 732 Bytes

Contents

# frozen_string_literal: true

module ForemanAnsible
  # Chained methods to extend the hosts menu with Ansible actions
  module HostsHelperExtensions
    extend ActiveSupport::Concern

    module Overrides
      def multiple_actions
        actions = super
        if User.current.can?(:create_job_invocations) &&
           User.current.can?(:play_roles_on_host)
          actions += [[_('Play Ansible roles'),
                       multiple_play_roles_hosts_path,
                       false]]
        end
        actions
      end
    end

    included do
      prepend Overrides
    end

    def ansible_roles_present?(host)
      host.ansible_roles.present? ||
        host.inherited_ansible_roles.present?
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
foreman_ansible-4.0.0 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-3.0.9 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-3.0.8 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-3.0.7 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-3.0.6 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-3.0.5 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-3.0.4 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-3.0.3 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-2.3.6 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-2.3.5 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-2.3.4 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-3.0.2 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-3.0.1 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-3.0.0 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-2.3.3 app/helpers/foreman_ansible/hosts_helper_extensions.rb
foreman_ansible-2.3.2 app/helpers/foreman_ansible/hosts_helper_extensions.rb