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::Models::File::CONTENT         => :download,
  Ddr::Models::File::EXTRACTED_TEXT  => :download,
  Ddr::Models::File::FITS            => :read,
  Ddr::Models::File::STRUCT_METADATA => :read,
  Ddr::Models::File::THUMBNAIL       => :read,
}.freeze

Instance Method Summary collapse

Methods inherited from AbilityDefinitions

call

Instance Method Details

#callObject



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

def call
  can :download, ActiveFedora::File do |file|
    can_download_datastream?(_dsid(file), _pid(file))
  end
end