consider both settings and configuration.yml, the former having precedence

pull/6827/head
Markus Kahl 11 years ago
parent 8e28025f10
commit 6768a4c393
  1. 18
      lib/omniauth/openid_connect/provider.rb

@ -39,8 +39,8 @@ module OmniAuth
end end
def self.load_generic_providers def self.load_generic_providers
providers = Hash(OpenProject::Configuration["openid_connect"]).reject do |key, value| providers = configs.reject do |pro, config|
all.any? { |p| p.provider_name == key } all.any? { |p| p.provider_name == pro }
end end
providers.each do |name, config| providers.each do |name, config|
@ -83,17 +83,17 @@ module OmniAuth
end end
def self.config def self.config
from_settings = if Setting.plugin_openproject_openid_connect.is_a? Hash Hash(configs[provider_name])
Hash(Hash(Setting.plugin_openproject_openid_connect["providers"])[provider_name])
else
{}
end end
if from_settings.empty? def self.configs
Hash(Hash(OpenProject::Configuration["openid_connect"])[provider_name]) from_settings = if Setting.plugin_openproject_openid_connect.is_a? Hash
Hash(Setting.plugin_openproject_openid_connect["providers"])
else else
from_settings {}
end end
# Settings override configuration.yml
Hash(OpenProject::Configuration["openid_connect"]).merge(from_settings)
end end
def to_hash def to_hash

Loading…
Cancel
Save