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
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
-
#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.
113 114 115 116 117 118 119 120 121 |
# File 'app/controllers/hyrax/single_use_links_viewer_controller.rb', line 113 def initialize(user, single_use_link) @current_user = user || ::User.new return unless single_use_link @single_use_link = single_use_link can :read, [ActiveFedora::Base, ::SolrDocument, Hyrax::Resource] do |obj| single_use_link.valid? && single_use_link.item_id == obj.id && single_use_link.destroy! end end |
Instance Attribute Details
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
111 112 113 |
# File 'app/controllers/hyrax/single_use_links_viewer_controller.rb', line 111 def current_user @current_user end |
#single_use_link ⇒ Object (readonly)
Returns the value of attribute single_use_link.
110 111 112 |
# File 'app/controllers/hyrax/single_use_links_viewer_controller.rb', line 110 def single_use_link @single_use_link end |