Class: WorkMigrationController

Inherits:
ApplicationController show all
Defined in:
app/controllers/work_migration_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#new_session_path

Instance Method Details

#migrateObject

Note:

No testing coverage for RuntimeError but depends on Dspaces



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/work_migration_controller.rb', line 4

def migrate
  work = Work.find(params[:id])
  if work.ark.present? && current_user.can_admin?(work.group)
    begin
      run_migration(work)
    rescue RuntimeError => e
      flash[:notice] = e.message
    end
  elsif !current_user.can_admin?(work.group)
    flash[:notice] = "Unauthorized migration"
    Honeybadger.notify("Unauthorized to migration work #{work.id} (current user: #{current_user.id})")
  else
    flash[:notice] = "The ark is blank, no migration from Dataspace is possible"
  end
  redirect_to work_path(work)
end