Module: Hyrax::DenyAccessOverrideBehavior

Included in:
DepositorsController, SingularSubresourceController
Defined in:
app/controllers/concerns/hyrax/deny_access_override_behavior.rb

Instance Method Summary collapse

Instance Method Details

#deny_access(exception) ⇒ Object

Overriding the default behavior from Hydra::Core::ControllerBehavior


4
5
6
7
8
9
10
11
# File 'app/controllers/concerns/hyrax/deny_access_override_behavior.rb', line 4

def deny_access(exception)
  if current_user&.persisted?
    redirect_to root_path, alert: exception.message
  else
    session['user_return_to'.freeze] = request.url
    redirect_to main_app.new_user_session_path, alert: exception.message
  end
end