Class: Hyrax::SingleUseLinksViewerController::Ability

Inherits:
Object
  • Object
show all
Includes:
CanCan::Ability
Defined in:
app/controllers/hyrax/single_use_links_viewer_controller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, single_use_link) ⇒ Ability

Returns a new instance of Ability.


85
86
87
88
89
90
91
92
93
# File 'app/controllers/hyrax/single_use_links_viewer_controller.rb', line 85

def initialize(user, single_use_link)
  @user = user || ::User.new
  return unless single_use_link

  @single_use_link = single_use_link
  can :read, [ActiveFedora::Base, ::SolrDocument] do |obj|
    single_use_link.valid? && single_use_link.itemId == obj.id && single_use_link.destroy!
  end
end

Instance Attribute Details

Returns the value of attribute single_use_link


83
84
85
# File 'app/controllers/hyrax/single_use_links_viewer_controller.rb', line 83

def single_use_link
  @single_use_link
end