Sha256: 363d49cc0a4156bf620d12ece97b0fb62a3b0e86569dfe0741e9124adf9588f2

Contents?: true

Size: 561 Bytes

Versions: 77

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

77 entries across 77 versions & 1 rubygems

Version Path
foreman_rh_cloud-9.0.59 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-9.0.58 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-9.0.57 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-10.0.1 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-9.0.56 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-9.0.55 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-9.0.54 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-9.0.53 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-9.0.52 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-8.0.52 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-9.0.51 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-8.0.51 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-7.0.48 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-7.0.47 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-8.0.50 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-8.0.49 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-8.0.48 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-8.0.47 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-8.0.46 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-6.0.45 app/controllers/concerns/insights_cloud/client_authentication.rb