app/controllers/concerns/sufia/depositors_controller_behavior.rb in sufia-6.0.0 vs app/controllers/concerns/sufia/depositors_controller_behavior.rb in sufia-6.1.0

- old
+ new

@@ -5,9 +5,20 @@ included do before_filter :authenticate_user! before_filter :validate_users, only: :create end + + # Overriding the default behavior from Hydra::Core::ContorllerBehavior + def deny_access(exception) + if current_user and current_user.persisted? + redirect_to root_path, alert: exception.message + else + session['user_return_to'.freeze] = request.url + redirect_to new_user_session_path, alert: exception.message + end + end + def create grantor = authorize_and_return_grantor grantee = ::User.from_url_component(params[:grantee_id]) if grantor.can_receive_deposits_from.include?(grantee) head :ok