Fixes argumentError occurs on /oauth/authorize when REST API is disabled (#43698).

git-svn-id: https://svn.redmine.org/redmine/trunk@24514 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu
2026-03-19 06:13:58 +00:00
parent b19d430e62
commit 9e7ee58924
2 changed files with 18 additions and 0 deletions

View File

@@ -113,6 +113,15 @@ Rails.application.config.to_prepare do
Doorkeeper::AuthorizationsController.class_eval do
require_sudo_mode :create, :destroy
alias_method :doorkeeper_render_error, :render_error
def render_error(arg = nil)
if arg
super
else
doorkeeper_render_error
end
end
end
end

View File

@@ -108,6 +108,15 @@ class OauthProviderSystemTest < ApplicationSystemTestCase
RestClient.get "http://localhost:#{test_port}/projects/onlinestore/time_entries.json", headers
end
end
def test_oauth_authorize_with_rest_api_disabled_should_render_403
with_settings rest_api_enabled: 0 do
log_user 'admin', 'admin'
visit '/oauth/authorize'
assert_text "You are not authorized to access this page."
end
end
end
private