Sha256: 0acee3e808bfddd17052790ead3b856580bb7be0e42301d71386f2285bbc916c

Contents?: true

Size: 753 Bytes

Versions: 29

Compression:

Stored size: 753 Bytes

Contents

class Hydra::PermissionsSolrDocument < SolrDocument
  def under_embargo?
    #permissions = permissions_doc(params[:id])
    embargo_key = ActiveFedora::SolrService.solr_name("embargo_release_date", Hydra::Datastream::RightsMetadata.date_indexer)
    if self[embargo_key] 
      embargo_date = Date.parse(self[embargo_key].split(/T/)[0])
      return embargo_date > Date.parse(Time.now.to_s)
    end
    false
  end

  def is_public?
    ActiveSupport::Deprecation.warn("Hydra::PermissionsSolrDocument.is_public? has been deprecated. Use can? instead.") 
    access_key = ActiveFedora::SolrService.solr_name("access", Hydra::Datastream::RightsMetadata.indexer)
    self[access_key].present? && self[access_key].first.downcase == "public"
  end
  

end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
hydra-access-controls-8.0.0.beta1 lib/hydra/permissions_solr_document.rb
hydra-access-controls-7.2.2 lib/hydra/permissions_solr_document.rb
hydra-access-controls-7.2.1 lib/hydra/permissions_solr_document.rb
hydra-access-controls-7.2.0 lib/hydra/permissions_solr_document.rb
hydra-access-controls-7.1.0 lib/hydra/permissions_solr_document.rb
hydra-access-controls-7.1.0.rc2 lib/hydra/permissions_solr_document.rb
hydra-access-controls-7.1.0.rc1 lib/hydra/permissions_solr_document.rb
hydra-access-controls-6.5.2 lib/hydra/permissions_solr_document.rb
hydra-access-controls-6.5.1 lib/hydra/permissions_solr_document.rb
hydra-access-controls-7.0.2 lib/hydra/permissions_solr_document.rb
hydra-access-controls-6.4.2 lib/hydra/permissions_solr_document.rb
hydra-access-controls-7.0.1 lib/hydra/permissions_solr_document.rb
hydra-access-controls-7.0.0 lib/hydra/permissions_solr_document.rb
hydra-access-controls-7.0.0.rc1 lib/hydra/permissions_solr_document.rb
hydra-access-controls-7.0.0.pre3 lib/hydra/permissions_solr_document.rb
hydra-access-controls-6.5.0 lib/hydra/permissions_solr_document.rb
hydra-access-controls-6.5.0.rc2 lib/hydra/permissions_solr_document.rb
hydra-access-controls-7.0.0.pre2 lib/hydra/permissions_solr_document.rb
hydra-access-controls-7.0.0.pre1 lib/hydra/permissions_solr_document.rb
hydra-access-controls-6.4.1 lib/hydra/permissions_solr_document.rb