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-5.0.36 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-5.0.35 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-5.0.34 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-5.0.33 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-3.0.32 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-4.0.32 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-5.0.32 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-4.0.31 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-5.0.31 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-5.0.30 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-4.0.30 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-3.0.29 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-4.0.29 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-5.0.29 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-3.0.28 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-5.0.28 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-4.0.27 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-3.0.26 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-4.0.26 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-4.0.25.1 app/controllers/concerns/insights_cloud/client_authentication.rb