Editor: Allow file retrieval after code run

This commit is contained in:
Sebastian Serth
2022-10-04 15:17:16 +02:00
committed by Sebastian Serth
parent fb9672c7a4
commit 60078701f5
22 changed files with 311 additions and 8 deletions

View File

@ -17,14 +17,14 @@ module AuthenticatedUrlHelper
add_query_parameters(url, {TOKEN_PARAM => token})
end
def retrieve!(klass, request, cookies = {})
def retrieve!(klass, request, cookies = {}, force_render_host: true)
# Don't use the default session mechanism and default cookie
request.session_options[:skip] = true
request.session_options[:skip] = true if force_render_host
# Show errors as JSON format, if any
request.format = :json
# Disallow access from normal domain and show an error instead
if ApplicationController::RENDER_HOST.present? && request.host != ApplicationController::RENDER_HOST
if force_render_host && ApplicationController::RENDER_HOST.present? && request.host != ApplicationController::RENDER_HOST
raise Pundit::NotAuthorizedError
end