Sha256: 363d49cc0a4156bf620d12ece97b0fb62a3b0e86569dfe0741e9124adf9588f2

Contents?: true

Size: 561 Bytes

Versions: 78

Compression:

Stored size: 561 Bytes

Contents

module InsightsCloud
  module ClientAuthentication
    extend ActiveSupport::Concern

    include ::Katello::Authentication::ClientAuthentication

    def authorize
      client_authorized? || super
    end

    def client_authorized?
      authenticate_client && valid_machine_user?
    end

    def valid_machine_user?
      subscribed_host_by_uuid(User.current.uuid).present?
    end

    def subscribed_host_by_uuid(uuid)
      @host = Host.unscoped.joins(:subscription_facet).where(:katello_subscription_facets => {:uuid => uuid }).first
    end
  end
end

Version data entries

78 entries across 78 versions & 1 rubygems

Version Path
foreman_rh_cloud-3.0.25 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-4.0.25 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-3.0.24.1 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-4.0.24.1 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-3.0.24 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-4.0.24 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-3.0.23 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-4.0.23 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-3.0.22 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-4.0.22 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-4.0.21.1 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-3.0.21.1 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-3.0.21 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-3.0.20 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-3.0.19 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-3.0.18.1 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-3.0.18 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-3.0.17 app/controllers/concerns/insights_cloud/client_authentication.rb