Add biomolecular toolkit license endpoint [SCI-5844]

This commit is contained in:
Oleksii Kriuchykhin 2021-07-01 12:03:25 +02:00
parent e881bf32ae
commit b69ed98e13
3 changed files with 15 additions and 3 deletions

View file

@ -4,10 +4,10 @@ class BioEddieAssetsController < ApplicationController
include BioEddieActions
include ActiveStorage::SetCurrent
before_action :load_vars, except: %i(create bmt_request)
before_action :load_vars, except: %i(create bmt_request license)
before_action :load_create_vars, only: :create
before_action :check_read_permission, except: %i(update create start_editing bmt_request)
before_action :check_read_permission, except: %i(update create start_editing bmt_request license)
before_action :check_edit_permission, only: %i(update create start_editing)
def create
@ -43,8 +43,17 @@ class BioEddieAssetsController < ApplicationController
end
end
def license
license_file_path = Rails.root.join('data/bioeddie/license.cxl')
if File.file?(license_file_path)
send_file(license_file_path)
else
render_404
end
end
def bmt_request
return_404 unless ENV['BIOMOLECULE_TOOLKIT_BASE_URL']
return render_404 unless ENV['BIOMOLECULE_TOOLKIT_BASE_URL']
uri = URI.parse(ENV['BIOMOLECULE_TOOLKIT_BASE_URL'])
uri.path = request.original_fullpath.remove('/biomolecule_toolkit')

View file

@ -774,6 +774,9 @@ Rails.application.routes.draw do
end
resources :bio_eddie_assets, only: %i(create update) do
collection do
get :license
end
member do
post :start_editing
end

0
data/bioeddie/.keep Normal file
View file