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

Fix empty settings on migration from auth providers

Oliver Günther9a5364eda4b8
diff --git a/modules/auth_saml/db/migrate/20240821121856_migrate_saml_settings_to_providers.rb b/modules/auth_saml/db/migrate/20240821121856_migrate_saml_settings_to_providers.rb
index ae82aba4de2..0510f6c8cba 100644
--- a/modules/auth_saml/db/migrate/20240821121856_migrate_saml_settings_to_providers.rb
+++ b/modules/auth_saml/db/migrate/20240821121856_migrate_saml_settings_to_providers.rb
@@ -1,6 +1,9 @@
class MigrateSamlSettingsToProviders < ActiveRecord::Migration[7.1]
def up
- providers = Hash(Setting.plugin_openproject_auth_saml).with_indifferent_access[:providers]
+ settings = Setting.plugin_openproject_auth_saml
+ return if settings.blank?
+
+ providers = Hash(settings).with_indifferent_access[:providers]
return if providers.blank?
providers.each do |name, options|
diff --git a/modules/openid_connect/db/migrate/20240829140616_migrate_oidc_settings_to_providers.rb b/modules/openid_connect/db/migrate/20240829140616_migrate_oidc_settings_to_providers.rb
index 46ea3ba0545..39ebcbfb5ed 100644
--- a/modules/openid_connect/db/migrate/20240829140616_migrate_oidc_settings_to_providers.rb
+++ b/modules/openid_connect/db/migrate/20240829140616_migrate_oidc_settings_to_providers.rb
@@ -30,7 +30,10 @@
class MigrateOidcSettingsToProviders < ActiveRecord::Migration[7.1]
def up
- providers = Hash(Setting.plugin_openproject_openid_connect).with_indifferent_access[:providers]
+ settings = Setting.plugin_openproject_openid_connect
+ return if settings.blank?
+
+ providers = Hash(settings).with_indifferent_access[:providers]
return if providers.blank?
providers.each do |name, configuration|