Sha256: 96c32767cc52ead2349661be1fe424b7f14162b919f18a323ec9d3d4b1a3266d

Contents?: true

Size: 562 Bytes

Versions: 6

Compression:

Stored size: 562 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

6 entries across 6 versions & 1 rubygems

Version Path
foreman_rh_cloud-10.0.3 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-11.0.3 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-11.0.2 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-11.0.1 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-11.0.0 app/controllers/concerns/insights_cloud/client_authentication.rb
foreman_rh_cloud-10.0.2 app/controllers/concerns/insights_cloud/client_authentication.rb