Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

allow changing of direct login provider at runtime

Markus Kahl5788a2473744
diff --git a/app/helpers/omniauth_helper.rb b/app/helpers/omniauth_helper.rb
index b8507f9b858..26428f7d9d7 100644
--- a/app/helpers/omniauth_helper.rb
+++ b/app/helpers/omniauth_helper.rb
@@ -42,6 +42,6 @@ module OmniauthHelper
# If this option is active /login will lead directly to the configured omniauth provider
# and so will a click on 'Sign in' (as opposed to opening the drop down menu).
def direct_login_provider
- OpenProject::Configuration["omniauth_direct_login_provider"]
+ Setting.omniauth_direct_login_provider
end
end
diff --git a/spec/support/shared/with_config.rb b/spec/support/shared/with_config.rb
index 19a8669bed9..ceaee33d8c6 100644
--- a/spec/support/shared/with_config.rb
+++ b/spec/support/shared/with_config.rb
@@ -70,6 +70,11 @@ class WithConfig
.to receive(:[])
.with(key.to_sym)
.and_return(value)
+
+ # if a configuration value was set then it automatically pins
+ # the respective setting as well which is why we stub this here too
+ allow(Setting).to receive(:[]).with(key.to_s).and_return(value)
+ allow(Setting).to receive(:[]).with(key.to_sym).and_return(value)
end
def aggregate_mocked_configuration(example, config)
@@ -90,6 +95,7 @@ class WithConfig
return if @call_original_implementation_done
allow(OpenProject::Configuration).to receive(:[]).and_call_original
+ allow(Setting).to receive(:[]).and_call_original
@call_original_implementation_done = true
end
end