Sha256: 7327ba83d784d467a60b0ed0cc59eb77350d5c51db2190c1b6a0a82b39141acf

Contents?: true

Size: 1.79 KB

Versions: 62

Compression:

Stored size: 1.79 KB

Contents

module Katello
  class ContentViewVersionImportHistory < Katello::Model
    include Authorization::ContentViewVersionImportHistory
    include Concerns::AuditCommentExtensions

    audited except: :metadata
    delegate :organization, to: :content_view_version
    delegate :id, to: :organization, prefix: true

    belongs_to :content_view_version, :class_name => "::Katello::ContentViewVersion", :inverse_of => :import_histories
    validates_lengths_from_database

    validates :content_view_version_id, presence: true
    validates :metadata, presence: true
    validates :path, presence: true
    serialize :metadata, Hash

    before_validation do |history|
      history.import_type = ContentViewVersionExportHistory.export_type_from_metadata(history.metadata)
    end

    scope :with_organization_id, ->(organization_id) do
      where(:content_view_version_id => ContentViewVersion.with_organization_id(organization_id))
    end

    scope :with_content_view_id, ->(cv_id) do
      where(:content_view_version_id => ContentViewVersion.where(content_view_id: cv_id))
    end

    scoped_search :on => :content_view_id, :relation => :content_view_version, :validator => ScopedSearch::Validators::INTEGER, :only_explicit => true
    scoped_search :on => :content_view_version_id, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
    scoped_search :on => :id, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
    scoped_search :on => :import_type, :rename => :type, :complete_value => ContentViewVersionExportHistory::EXPORT_TYPES

    def self.generate_audit_comment(user:, content_view_name:)
      truncate_audit_comment(_("Content imported by %{user} into content view '%{name}'") % {
        user: user.to_label,
        name: content_view_name
      })
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

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