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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Pass strategy key into filtered_strategy?
Oliver Günther8b19e9a80f0f
diff --git a/modules/auth_plugins/lib/open_project/plugins/auth_plugin.rb b/modules/auth_plugins/lib/open_project/plugins/auth_plugin.rbindex 3a62138b07c..12c4d2b49c9 100644--- a/modules/auth_plugins/lib/open_project/plugins/auth_plugin.rb+++ b/modules/auth_plugins/lib/open_project/plugins/auth_plugin.rb@@ -46,8 +46,9 @@ module OpenProject::Pluginsenddef self.providers_for(strategy)- matching = Array(strategies[strategy_key(strategy)])- filtered_strategies matching.map(&:call).flatten.map(&:to_hash)+ key = strategy_key(strategy)+ matching = Array(strategies[key])+ filtered_strategies(key, matching.map(&:call).flatten.map(&:to_hash))enddef self.login_provider_for(user)@@ -63,21 +64,26 @@ module OpenProject::Pluginsdef self.providersRequestStore.fetch(:openproject_omniauth_filtered_strategies) do- filtered_strategies strategies.values.flatten.map(&:call).flatten.map(&:to_hash)+ strategies.flat_map do |strategy_key, values|+ filtered_strategies(strategy_key, values.flat_map(&:call).flat_map(&:to_hash))+ endendend- def self.filtered_strategies(options)+ def self.filtered_strategies(strategy_key, options)options.select do |provider|- name = provider[:name]&.to_s- next true if !EnterpriseToken.show_banners? || name == 'developer'-- warn_unavailable(name)+ filtered = filtered_strategy?(strategy_key, provider)+ warn_unavailable(name) unless filtered- false+ filteredendend+ def self.filtered_strategy?(_strategy_key, provider)+ name = provider[:name]&.to_s+ !EnterpriseToken.show_banners? || name == 'developer'+ end+def self.strategy_key(strategy)return strategy if strategy.is_a? Symbolreturn strategy.to_sym if strategy.is_a? String