Check if db is writable on oauth authorization pages
This commit is contained in:
parent
86fae8980d
commit
5bb23f6f5f
2 changed files with 16 additions and 0 deletions
|
@ -7,4 +7,6 @@ class Oauth2AuthorizationsController < Doorkeeper::AuthorizationsController
|
||||||
allow_all_form_action :only => :new
|
allow_all_form_action :only => :new
|
||||||
|
|
||||||
authorize_resource :class => false
|
authorize_resource :class => false
|
||||||
|
|
||||||
|
before_action :check_database_writable
|
||||||
end
|
end
|
||||||
|
|
|
@ -102,6 +102,20 @@ class Oauth2AuthorizationsControllerTest < ActionDispatch::IntegrationTest
|
||||||
assert_select "p", "The requested scope is invalid, unknown, or malformed."
|
assert_select "p", "The requested scope is invalid, unknown, or malformed."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_new_db_readonly
|
||||||
|
application = create(:oauth_application, :scopes => "write_api")
|
||||||
|
|
||||||
|
session_for(create(:user))
|
||||||
|
|
||||||
|
with_settings(:status => "database_readonly") do
|
||||||
|
get oauth_authorization_path(:client_id => application.uid,
|
||||||
|
:redirect_uri => application.redirect_uri,
|
||||||
|
:response_type => "code",
|
||||||
|
:scope => "write_api")
|
||||||
|
assert_redirected_to offline_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_create
|
def test_create
|
||||||
application = create(:oauth_application, :scopes => "write_api")
|
application = create(:oauth_application, :scopes => "write_api")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue