Project

General

Profile

« Previous | Next » 

Revision d1ff68b5

Added by Stephen Benjamin about 10 years ago

fixes #5224 - Don't update a user with blank LDAP attribute values

(cherry picked from commit 2fe12e2c5f011d68cb4afbf3cd5e070e1af36155)

View differences:

app/models/user.rb
# update with returned attrs, maybe some info changed in LDAP
old_hash = user.avatar_hash
User.as :admin do
user.update_attributes(attrs.slice(:firstname, :lastname, :mail, :avatar_hash))
user.update_attributes(attrs.slice(:firstname, :lastname, :mail, :avatar_hash).delete_if { |k, v| v.blank? })
end if attrs.is_a? Hash
# clean up old avatar if it exists and the image isn't in use by anyone else

Also available in: Unified diff