Sha256: 4e0ce7db72261f4d2ad94d8f3d15b76cb8dd912b63e63cf91294df6aa54ca511

Contents?: true

Size: 1.76 KB

Versions: 26

Compression:

Stored size: 1.76 KB

Contents

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

    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:, path:, content_view_name:)
      _("Content imported from %{path} into content view '%{name}' by %{user}") % {
        path: path,
        user: user.to_label,
        name: content_view_name
      }
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
katello-4.3.1 app/models/katello/content_view_version_import_history.rb
katello-4.4.0.rc1 app/models/katello/content_view_version_import_history.rb
katello-4.2.2 app/models/katello/content_view_version_import_history.rb
katello-4.3.0 app/models/katello/content_view_version_import_history.rb
katello-4.3.0.rc4 app/models/katello/content_view_version_import_history.rb
katello-4.3.0.rc3 app/models/katello/content_view_version_import_history.rb
katello-4.3.0.rc2.1 app/models/katello/content_view_version_import_history.rb
katello-4.3.0.rc2 app/models/katello/content_view_version_import_history.rb
katello-4.3.0.rc1 app/models/katello/content_view_version_import_history.rb
katello-4.2.1 app/models/katello/content_view_version_import_history.rb
katello-4.2.0.1 app/models/katello/content_view_version_import_history.rb
katello-4.1.4 app/models/katello/content_view_version_import_history.rb
katello-4.2.0.1.rc3 app/models/katello/content_view_version_import_history.rb
katello-4.2.0.1.rc2 app/models/katello/content_view_version_import_history.rb
katello-4.2.0.rc2 app/models/katello/content_view_version_import_history.rb
katello-4.1.3 app/models/katello/content_view_version_import_history.rb
katello-4.2.0.rc1 app/models/katello/content_view_version_import_history.rb
katello-4.1.2.1 app/models/katello/content_view_version_import_history.rb
katello-4.1.2 app/models/katello/content_view_version_import_history.rb
katello-4.1.1 app/models/katello/content_view_version_import_history.rb