Sha256: f1397b59593c976364cbd41207907314e2303eb91007fd0c2b4a60ab6bcd4551

Contents?: true

Size: 1.16 KB

Versions: 223

Compression:

Stored size: 1.16 KB

Contents

module Katello
  module Concerns
    module UserExtensions
      extend ActiveSupport::Concern

      included do
        has_many :task_statuses, :dependent => :destroy, :class_name => "Katello::TaskStatus"
        has_many :activation_keys, :dependent => :nullify, :class_name => "Katello::ActivationKey"
        has_many :subscription_facets, :dependent => :nullify, :class_name => "Katello::Host::SubscriptionFacet"

        def self.remote_user
          SETTINGS[:katello][:pulp][:default_login]
        end

        def self.cp_oauth_header
          { 'cp-user' => User.anonymous_admin.login }
        end

        def self.cp_config(cp_oauth_header)
          Thread.current[:cp_oauth_header] = cp_oauth_header
          yield if block_given?
        ensure
          Thread.current[:cp_oauth_header] = nil if block_given?
        end

        # is the current user consumer? (rhsm)
        def self.consumer?
          User.current.is_a? CpConsumerUser
        end

        def cp_oauth_header
          { 'cp-user' => self.login }
        end

        def allowed_organizations
          admin? ? Organization.all : self.organizations
        end
      end
    end
  end
end

Version data entries

223 entries across 223 versions & 1 rubygems

Version Path
katello-4.14.2 app/models/katello/concerns/user_extensions.rb
katello-4.15.0 app/models/katello/concerns/user_extensions.rb
katello-4.15.0.rc2 app/models/katello/concerns/user_extensions.rb
katello-4.15.0.rc1 app/models/katello/concerns/user_extensions.rb
katello-4.14.1 app/models/katello/concerns/user_extensions.rb
katello-4.14.0 app/models/katello/concerns/user_extensions.rb
katello-4.14.0.rc3 app/models/katello/concerns/user_extensions.rb
katello-4.14.0.rc2 app/models/katello/concerns/user_extensions.rb
katello-4.14.0.rc1.1 app/models/katello/concerns/user_extensions.rb
katello-4.14.0.rc1 app/models/katello/concerns/user_extensions.rb
katello-4.13.1 app/models/katello/concerns/user_extensions.rb
katello-4.13.0 app/models/katello/concerns/user_extensions.rb
katello-4.12.1 app/models/katello/concerns/user_extensions.rb
katello-4.13.0.rc1 app/models/katello/concerns/user_extensions.rb
katello-4.12.0 app/models/katello/concerns/user_extensions.rb
katello-4.12.0.rc3 app/models/katello/concerns/user_extensions.rb
katello-4.12.0.rc2 app/models/katello/concerns/user_extensions.rb
katello-4.12.0.rc1 app/models/katello/concerns/user_extensions.rb
katello-4.11.1 app/models/katello/concerns/user_extensions.rb
katello-4.11.0 app/models/katello/concerns/user_extensions.rb