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
Don't call create service on auto create
Oliver Günther9f1d058299c2
diff --git a/app/models/user.rb b/app/models/user.rbindex bef894a1379..51cce45acae 100644--- a/app/models/user.rb+++ b/app/models/user.rb@@ -244,20 +244,10 @@ class User < Principaldef self.try_authentication_and_create_user(login, password)return nil if OpenProject::Configuration.disable_password_login?- attrs = LdapAuthSource.authenticate(login, password)- return unless attrs+ user = LdapAuthSource.authenticate(login, password)- call = Users::CreateService- .new(user: User.system)- .call(attrs)-- user = call.result-- call.on_failure do |result|- Rails.logger.error "Failed to auto-create user from auth-source: #{result.message}"-- # TODO We have no way to pass back the contract errors in this place- user.errors.merge! call.errors+ if user&.new_record?+ Rails.logger.error "Failed to auto-create user from auth-source, as data is missing."enduserdiff --git a/app/services/ldap/base_service.rb b/app/services/ldap/base_service.rbindex 4e6db189947..a2afb8b3642 100644--- a/app/services/ldap/base_service.rb+++ b/app/services/ldap/base_service.rb@@ -61,6 +61,7 @@ module Ldapif call.success?Rails.logger.info { "[LDAP user sync] User '#{call.result.login}' created." }else+ # Ensure contract errors are merged into the usercall.result.errors.merge! call.errorsRails.logger.error { "[LDAP user sync] User '#{attrs[:login]}' could not be created: #{call.message}" }end