Do not attempt to check username/email against central in on-prem

This happens when a new SAML or LDAP user signs up and it is not yet
created in cartodb. It results in a sync call to Central HTTP API.

This avoids such call when the Central api is not enabled (notably in
on-premise installations).

Also this fixes tests that otherwise wait forever on an `until`.
pull/16239/head
Rafa de la Torre 4 years ago
parent ed7a773167
commit 005453403e

@ -106,6 +106,7 @@ sudo make install
- Fix CI build by changing machine spec [#16192](https://github.com/CartoDB/cartodb/pull/16192)
- Modify superadmin users activity endpoint to allow pagination [#16226](https://github.com/CartoDB/cartodb/pull/16226)
- Update cartodb-common to v1.1.1, which contains serveral logging fixes [#16182](https://github.com/CartoDB/cartodb/pull/16182)
- Fix SAML and LDAP integrations for on-premise installations [#16239](https://github.com/CartoDB/cartodb/pull/16239)
- Read config for public statics compilation [#16234](https://github.com/CartoDB/cartodb/pull/16234)
- Show dataset version in subscription list and details [#16235](https://github.com/CartoDB/cartodb/pull/16235)
- Fix error that avoid to render Spatial Data Catalog properly in Internet Explorer [#16236](https://github.com/CartoDB/cartodb/pull/16236)

@ -14,7 +14,7 @@ module CartodbCentralSynchronizable
def validate_credentials_not_taken_in_central
return true unless user?
if Cartodb::Central.message_broker_sync_disabled?
if Cartodb::Central.api_sync_disabled?
log_central_unavailable
return true
end

@ -213,7 +213,7 @@ describe Carto::UserCreation do
it 'neither creates a new User nor sends the mail and marks creation as failure if saving fails' do
organization.save
Cartodb::Central.stubs(:message_broker_sync_enabled?).returns(false)
Cartodb::Central.stubs(:api_sync_disabled?).returns(true)
::Resque.expects(:enqueue).with(::Resque::UserJobs::Mail::NewOrganizationUser).never
::User.any_instance.stubs(:save).raises('saving error')
@ -232,7 +232,7 @@ describe Carto::UserCreation do
end
it 'neither creates a new User nor sends the mail and marks creation as failure if Central fails' do
Cartodb::Central.stubs(:message_broker_sync_enabled?).returns(true)
Cartodb::Central.stubs(:api_sync_disabled?).returns(false)
::User.any_instance.stubs(:create_in_central).raises('Error on state creating_user_in_central, mark_as_failure: false. Error: Application server responded with http 422: {"errors":["Existing username."]}')
::Resque.expects(:enqueue).with(::Resque::UserJobs::Mail::NewOrganizationUser).never
@ -302,7 +302,7 @@ describe Carto::UserCreation do
end
def prepare_fake_central_user
Cartodb::Central.stubs(:message_broker_sync_enabled?).returns(true)
Cartodb::Central.stubs(:api_sync_disabled?).returns(false)
fake_central_client = {}
fake_central_client.stubs(:create_organization_user).returns(true)
::User.any_instance.stubs(:cartodb_central_client).returns(fake_central_client)

Loading…
Cancel
Save