mirror of
https://github.com/redmine/redmine.git
synced 2026-04-02 02:31:17 +02:00
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:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user