Class: Ddr::Auth::DatastreamAbilityDefinitions

Inherits:
AbilityDefinitions show all
Defined in:
lib/ddr/auth/ability_definitions/datastream_ability_definitions.rb

Constant Summary collapse

DATASTREAM_DOWNLOAD_ABILITIES =

Maps datastream id to an ability required on the object to download the datastream.

Datastreams not listed cannot be downloaded, except of course by the :manage ability.

{
  Ddr::Datastreams::CONTENT         => :download,
  Ddr::Datastreams::DESC_METADATA   => :read,
  Ddr::Datastreams::EXTRACTED_TEXT  => :download,
  Ddr::Datastreams::FITS            => :read,
  Ddr::Datastreams::MULTIRES_IMAGE  => :read,
  Ddr::Datastreams::STRUCT_METADATA => :read,
  Ddr::Datastreams::THUMBNAIL       => :read,
}.freeze

Instance Method Summary collapse

Methods inherited from AbilityDefinitions

call

Instance Method Details

#callObject



20
21
22
23
24
# File 'lib/ddr/auth/ability_definitions/datastream_ability_definitions.rb', line 20

def call
  can :download, ActiveFedora::Datastream do |ds|
    can_download_datastream?(ds.dsid, ds.pid)
  end
end