Sha256: 5c694ae6a206d9a29248e6b243fe753e9635d414a9220c6946af38b4155e8224

Contents?: true

Size: 652 Bytes

Versions: 43

Compression:

Stored size: 652 Bytes

Contents

module Ddr
  module Governable
    extend ActiveSupport::Concern

    included do
      attribute :admin_policy_id, Valkyrie::Types::ID.optional
     end

    def admin_policy
      if admin_policy_id.present?
        Valkyrie.config.metadata_adapter.query_service.find_by(id: admin_policy_id)
      end
    end

    def admin_policy=(admin_policy)
      unless admin_policy.is_a? Ddr::Collection
        raise ArgumentError,
              I18n.t('ddr.core.errors.incorrect_resource_class',
                     subject: 'Admin Policy', resource_class: 'Ddr::Core::Collection')
      end
      self.admin_policy_id = admin_policy.id
    end

  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
ddr-core-1.17.0 app/models/concerns/ddr/governable.rb
ddr-core-1.16.0 app/models/concerns/ddr/governable.rb
ddr-core-1.15.0 app/models/concerns/ddr/governable.rb
ddr-core-1.14.0 app/models/concerns/ddr/governable.rb
ddr-core-1.13.2 app/models/concerns/ddr/governable.rb
ddr-core-1.13.1 app/models/concerns/ddr/governable.rb
ddr-core-1.13.0 app/models/concerns/ddr/governable.rb
ddr-core-1.12.2 app/models/concerns/ddr/governable.rb
ddr-core-1.12.1 app/models/concerns/ddr/governable.rb
ddr-core-1.12.0 app/models/concerns/ddr/governable.rb
ddr-core-1.11.0 app/models/concerns/ddr/governable.rb
ddr-core-1.10.0 app/models/concerns/ddr/governable.rb
ddr-core-1.9.0 app/models/concerns/ddr/governable.rb
ddr-core-1.8.0 app/models/concerns/ddr/governable.rb
ddr-core-1.7.0 app/models/concerns/ddr/governable.rb
ddr-core-1.6.6 app/models/concerns/ddr/governable.rb
ddr-core-1.6.5 app/models/concerns/ddr/governable.rb
ddr-core-1.6.4 app/models/concerns/ddr/governable.rb
ddr-core-1.6.3 app/models/concerns/ddr/governable.rb
ddr-core-1.6.2 app/models/concerns/ddr/governable.rb