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

Prevent creating empty keys in the user_data hash

Oliver Günther82b80be067b7
diff --git a/modules/ldap_groups/app/services/ldap_groups/synchronize_groups_service.rb b/modules/ldap_groups/app/services/ldap_groups/synchronize_groups_service.rb
index 55ebfd87c71..bb9b5fec488 100644
--- a/modules/ldap_groups/app/services/ldap_groups/synchronize_groups_service.rb
+++ b/modules/ldap_groups/app/services/ldap_groups/synchronize_groups_service.rb
@@ -106,7 +106,11 @@ module LdapGroups
filter: memberof_filter(group),
attributes: search_attributes) do |entry|
data = ldap.get_user_attributes_from_ldap_entry(entry)
- users[data[:login]] = data.except(:dn)
+ if data[:login].present?
+ users[data[:login]] = data.except(:dn)
+ else
+ Rails.logger.warn { "Tried to add user but mapped login is empty for #{entry.dn}. Ignoring this user."}
+ end
end
users