diff --git a/db/migrate/20231206212031_delete_extended_socio_demographic_authorization_handler_settings_on_initiatives.rb b/db/migrate/20231206212031_delete_extended_socio_demographic_authorization_handler_settings_on_initiatives.rb index 0186958..5fd05b7 100644 --- a/db/migrate/20231206212031_delete_extended_socio_demographic_authorization_handler_settings_on_initiatives.rb +++ b/db/migrate/20231206212031_delete_extended_socio_demographic_authorization_handler_settings_on_initiatives.rb @@ -9,6 +9,11 @@ def change Decidim::ResourcePermission.all.each do |resource_permission| next if resource_permission.permissions.blank? + if resource_permission.resource.blank? + resource_permission.delete + next + end + resource_permission.permissions.each do |action, authorization| if authorization.has_key?("authorization_handlers") && authorization["authorization_handlers"].has_key?("extended_socio_demographic_authorization_handler") resource_permission.permissions.delete(action)