Change the oauth authorizations controller writing role method.

This commit is contained in:
Fosco Marotto 2021-02-14 15:52:38 -05:00
parent 0d5acfc3fb
commit 0f85ba2f12

View File

@ -9,9 +9,6 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
include Localized include Localized
include ForceDbWriterRole
around_action :force_writer_db_role, only: [:store_current_location, :render_success]
private private
def store_current_location def store_current_location
@ -20,7 +17,9 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
def render_success def render_success
if skip_authorization? || (matching_token? && !truthy_param?('force_login')) if skip_authorization? || (matching_token? && !truthy_param?('force_login'))
redirect_or_render authorize_response ActiveRecord::Base.connected_to(role: :writing) do
redirect_or_render authorize_response
end
elsif Doorkeeper.configuration.api_only elsif Doorkeeper.configuration.api_only
render json: pre_auth render json: pre_auth
else else