app/models/concerns/hyrax/ability.rb
# We check based on the depositor, because the depositor may not have edit
# access to the work if it went through a mediated deposit workflow that
# removes edit access for the depositor.
We check based on the depositor, because the depositor may not have edit
access to the work if it went through a mediated deposit workflow that
removes edit access for the depositor.
We check based on the depositor because the depositor may not have edit access to the work if it went through a mediated deposit workflow that removes edit access for the depositor .
def trophy_abilities
      can [:create, :destroy], Trophy do |t|
        doc = ActiveFedora::Base.search_by_id(t.work_id, fl: 'depositor_ssim')
        current_user.user_key == doc.fetch('depositor_ssim').first
      end
    end
def trophy_abilities can [ :create , :destroy ] , Trophy do | t | doc = ActiveFedora :: Base . search_by_id ( t . work_id , fl : 'depositor_ssim' ) current_user . user_key == doc . fetch ( 'depositor_ssim' ) . first end end
We check based on the depositor, because the depositor may not have edit
access to the work if it went through a mediated deposit workflow that
removes edit access for the depositor.
We check based on the depositor because the depositor may not have edit access to the work if it went through a mediated deposit workflow that removes edit access for the depositor .