Class: Hyrax::SingleUseLinksViewerController::Ability
- Inherits:
-
Object
- Object
- Hyrax::SingleUseLinksViewerController::Ability
- Includes:
- CanCan::Ability
- Defined in:
- app/controllers/hyrax/single_use_links_viewer_controller.rb
Instance Attribute Summary collapse
-
#single_use_link ⇒ Object
readonly
Returns the value of attribute single_use_link.
Instance Method Summary collapse
-
#initialize(user, single_use_link) ⇒ Ability
constructor
A new instance of Ability.
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
#single_use_link ⇒ Object (readonly)
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 |