Sha256: 23f3f10c17b2c227a65cf466fa1e482f4cd189be0cdd7431d873b8fea5da420d

Contents?: true

Size: 798 Bytes

Versions: 3

Compression:

Stored size: 798 Bytes

Contents

ActiveFedora::Base.class_eval do

  def active?
    state == 'A'
  end

  def auditable?
    begin
      self.is_a? ActiveFedora::Auditable
    rescue
      false
    end
  end

  def has_permissions?
    self.is_a? Hydra::ModelMixins::RightsMetadata
  end

  def governable?
    !governed_by_association.nil?
  end

  def governed_by_association
    self.reflections.each do |name, reflection|
      # FIXME add class name condition, i.e.:
      # && reflection.class_name == [Hydra configured policy class or Hydra::AdminPolicy]
      return reflection if reflection.macro == :belongs_to && reflection.options[:property] == :is_governed_by
    end
  end

  def object_xml
    # XXX https://github.com/projecthydra/rubydora/pull/26
    inner_object.repository.object_xml(:pid => pid)
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fcrepo_admin-0.5.4 lib/fcrepo_admin/decorators/active_fedora/base_decorator.rb
fcrepo_admin-0.5.3 lib/fcrepo_admin/decorators/active_fedora/base_decorator.rb
fcrepo_admin-0.5.2 lib/fcrepo_admin/decorators/active_fedora/base_decorator.rb