Skip to content

Commit

Permalink
Remove file upload capability for Box.com (#2179)
Browse files Browse the repository at this point in the history
Box has changed it's API and uploading student files from Box
is no longer functional in the application.

Emory SCO has changed it's official storage solution to Microsoft OneDrive,
and confirmed that there is no need to restore Box functionality.
  • Loading branch information
mark-dce authored Oct 10, 2021
1 parent bd4b3b0 commit 88e62b6
Show file tree
Hide file tree
Showing 22 changed files with 1 addition and 2,197 deletions.
2 changes: 0 additions & 2 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ Performance/Detect:
Performance/RegexpMatch:
Exclude:
- 'app/actors/hyrax/actors/etd_actor.rb'
- 'app/jobs/import_url_job.rb'
- 'lib/tasks/fix_collection_type_labels.rake'

# Offense count: 3
Expand All @@ -56,7 +55,6 @@ RSpec/RepeatedDescription:
Rails/ApplicationJob:
Exclude:
- 'app/jobs/graduation_job.rb'
- 'app/jobs/import_url_job.rb'
- 'app/jobs/proquest_completion_job.rb'
- 'app/jobs/proquest_job.rb'

Expand Down
22 changes: 0 additions & 22 deletions app/controllers/box_auth_controller.rb

This file was deleted.

9 changes: 0 additions & 9 deletions app/controllers/box_redirect_controller.rb

This file was deleted.

29 changes: 0 additions & 29 deletions app/controllers/concerns/hyrax/uploads_controller_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ module Hyrax::UploadsControllerBehavior
# Assumption: We only handle 1 file at a time
def create
@upload.attributes = upload_attributes
hard_code_file
@upload.save!
queue_box_download
end

def upload_attributes
Expand All @@ -26,33 +24,6 @@ def upload_attributes
upload_attributes
end

# Student wants to upload a remote file from Box
def box_upload?
params['remote_url'].present?
end

# If the student is uploading a file from Box, we
# don't have the file available yet, so we need to
# temporarily hard-code @upload.file to an object
# with a filename (because the hyrax view assumes it
# will be there).
def hard_code_file
return unless box_upload?

filename = params['filename'] || "temporary_filename.pdf"
fuf = ::FakeUploadedFile.new(filename)
fuf.original_filename = filename
@upload.file = fuf
fuf.close
end

# Queue background job to fetch the file from Box
def queue_box_download
return unless box_upload?

::FetchRemoteFileJob.perform_later(@upload.id, params['remote_url'])
end

def destroy
@upload.destroy
head :no_content
Expand Down
36 changes: 0 additions & 36 deletions app/javascript/Files.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ import FileDelete from './FileDelete'
import SupplementalFileDelete from './SupplementalFileDelete'
import SupplementalFileUploader from './SupplementalFileUploader'
import axios from 'axios'
import BoxSupplementalFileUploader from './lib/BoxSupplementalFileUploader'
import _ from 'lodash'
export default {
Expand All @@ -155,38 +154,6 @@ export default {
}
}
},
mounted () {
var folderId = '0'
var accessToken = window.location.search.split('&access_token=')[1]
if (accessToken) {
var filePicker = new Box.FilePicker()
filePicker.show(folderId, accessToken, {
container: '#box-picker',
maxSelectable: 1,
canUpload: false,
logoUrl: 'box',
canCreateNewFolder: false
})
filePicker.addListener('cancel', (event) => {
filePicker.hide()
})
filePicker.addListener('choose', (event) => {
var boxFileUploader = new BoxSupplementalFileUploader({
boxAccessToken: accessToken,
event: event,
csrfToken: this.sharedState.token,
formStore: this.sharedState,
filePicker: filePicker
})
boxFileUploader.getUrlFromBox()
})
}
},
methods: {
// Determine if the file is a Hyrax::UploadedFile
// or a ::FileSet that has already been saved.
Expand Down Expand Up @@ -252,9 +219,6 @@ export default {
boxOAuth () {
window.location = this.boxOAuthUrl()
},
boxOAuthUrl () {
return `https://account.box.com/api/oauth2/authorize?response_type=code&client_id=${boxClientId()}&redirect_uri${window.location.origin}/auth/box&state=${this.sharedState.ipeId}`
},
supplementalFileTitleName (key) {
return `etd[supplemental_file_metadata][${key}]title`
},
Expand Down
63 changes: 0 additions & 63 deletions app/javascript/lib/BoxFileUploader.js

This file was deleted.

7 changes: 0 additions & 7 deletions app/javascript/lib/BoxSupplementalFileUploader.js

This file was deleted.

41 changes: 0 additions & 41 deletions app/javascript/test/lib/BoxFileUploader.test.js

This file was deleted.

72 changes: 0 additions & 72 deletions app/jobs/import_url_job.rb

This file was deleted.

49 changes: 0 additions & 49 deletions app/services/hyrax/workflow/box_error_notification.rb

This file was deleted.

Loading

0 comments on commit 88e62b6

Please sign in to comment.