Module: CurationConcerns::SingleUseLinksControllerBehavior

Extended by:
ActiveSupport::Concern
Includes:
Blacklight::SearchHelper
Included in:
SingleUseLinksController
Defined in:
app/controllers/concerns/curation_concerns/single_use_links_controller_behavior.rb

Instance Method Summary collapse

Instance Method Details

#create_downloadObject



23
24
25
26
# File 'app/controllers/concerns/curation_concerns/single_use_links_controller_behavior.rb', line 23

def create_download
  @su = SingleUseLink.create itemId: params[:id], path: main_app.download_path(id: params[:id])
  render plain: curation_concerns.download_single_use_link_url(@su.downloadKey)
end

#create_showObject



28
29
30
31
# File 'app/controllers/concerns/curation_concerns/single_use_links_controller_behavior.rb', line 28

def create_show
  @su = SingleUseLink.create(itemId: params[:id], path: asset_show_path)
  render plain: curation_concerns.show_single_use_link_url(@su.downloadKey)
end


14
15
16
17
18
19
20
21
# File 'app/controllers/concerns/curation_concerns/single_use_links_controller_behavior.rb', line 14

def deny_link_access(exception)
  if current_user && current_user.persisted?
    redirect_to main_app.root_url, alert: "You do not have sufficient privileges to create links to this document"
  else
    session["user_return_to"] = request.url
    redirect_to new_user_session_url, alert: exception.message
  end
end

#destroyObject



38
39
40
41
# File 'app/controllers/concerns/curation_concerns/single_use_links_controller_behavior.rb', line 38

def destroy
  SingleUseLink.find_by_downloadKey(params[:link_id]).destroy
  head :ok
end

#indexObject



33
34
35
36
# File 'app/controllers/concerns/curation_concerns/single_use_links_controller_behavior.rb', line 33

def index
  links = SingleUseLink.where(itemId: params[:id]).map { |link| show_presenter.new(link) }
  render partial: 'curation_concerns/file_sets/single_use_link_rows', locals: { single_use_links: links }
end