Skip to content

Commit

Permalink
Staged Download auth (#1069)
Browse files Browse the repository at this point in the history
Co-authored-by: JP Engstrom <jpengstrom@macbook-pro.lan>
  • Loading branch information
JP Engstrom and JP Engstrom authored Oct 22, 2024
1 parent 83002db commit 9d2ee92
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/download_original_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class DownloadOriginalController < ApplicationController
include Blacklight::Catalog
include CheckAuthorization

before_action :check_authorization, except: [:staged]
before_action :check_authorization

def tiff
if S3Service.exists_in_s3(tiff_pairtree_path)
Expand Down
12 changes: 12 additions & 0 deletions spec/requests/download_original_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,26 @@
get "/download/tiff/#{yale_work[:child_oids_ssim].first}"
expect(response).to have_http_status(:unauthorized) # 401
end
it 'does not stage the download if set to YCO' do
get "/download/tiff/#{yale_work[:child_oids_ssim].first}/staged"
expect(response).to have_http_status(:unauthorized) # 401
end
it 'does not display if set to OWP' do
get "/download/tiff/#{owp_work_without_permission[:child_oids_ssim].first}"
expect(response).to have_http_status(:unauthorized) # 401
end
it 'does not stage the download if set to OWP' do
get "/download/tiff/#{owp_work_without_permission[:child_oids_ssim].first}/staged"
expect(response).to have_http_status(:unauthorized) # 401
end
it 'does not display if set to private' do
get "/download/tiff/#{private_work[:child_oids_ssim].first}"
expect(response).to have_http_status(:not_found) # 404
end
it 'does not stage the download if set to private' do
get "/download/tiff/#{private_work[:child_oids_ssim].first}/staged"
expect(response).to have_http_status(:not_found) # 404
end
end

context 'as an authenticated yale user' do
Expand Down

0 comments on commit 9d2ee92

Please sign in to comment.