Class: CurationConcerns::SingleUseLinksViewerController::Ability

Inherits:
Object
  • Object
show all
Includes:
CanCan::Ability
Defined in:
app/controllers/curation_concerns/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.



10
11
12
13
14
15
16
17
18
# File 'app/controllers/curation_concerns/single_use_links_viewer_controller.rb', line 10

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

  @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 if single_use_link
end

Instance Attribute Details

Returns the value of attribute single_use_link.



8
9
10
# File 'app/controllers/curation_concerns/single_use_links_viewer_controller.rb', line 8

def single_use_link
  @single_use_link
end