Sha256: 5652f4fbad277a6789d4d9c587b6eb0af678e78c65bbbfed697024f68aa34f07

Contents?: true

Size: 1.05 KB

Versions: 16

Compression:

Stored size: 1.05 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"

        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

16 entries across 16 versions & 1 rubygems

Version Path
katello-3.2.0.rc2 app/models/katello/concerns/user_extensions.rb
katello-3.2.0.rc1.1 app/models/katello/concerns/user_extensions.rb
katello-3.2.0.rc1 app/models/katello/concerns/user_extensions.rb
katello-3.1.0.1 app/models/katello/concerns/user_extensions.rb
katello-3.1.0 app/models/katello/concerns/user_extensions.rb
katello-3.1.0.rc2.1 app/models/katello/concerns/user_extensions.rb
katello-3.0.2 app/models/katello/concerns/user_extensions.rb
katello-3.1.0.rc1 app/models/katello/concerns/user_extensions.rb
katello-3.0.1 app/models/katello/concerns/user_extensions.rb
katello-3.0.0 app/models/katello/concerns/user_extensions.rb
katello-3.0.0.rc7 app/models/katello/concerns/user_extensions.rb
katello-3.0.0.rc5 app/models/katello/concerns/user_extensions.rb
katello-3.0.0.rc4 app/models/katello/concerns/user_extensions.rb
katello-3.0.0.rc3 app/models/katello/concerns/user_extensions.rb
katello-3.0.0.rc2 app/models/katello/concerns/user_extensions.rb
katello-3.0.0.rc1 app/models/katello/concerns/user_extensions.rb