Project

General

Profile

Patch #3358 » 07_ldap_update.patch

Jérémy Lal, 2009-07-14 14:37

View differences:

redmine-0.9.0.new/app/controllers/my_controller.rb 2009-07-14 11:31:15.590861206 +0200
@user.pref.attributes = params[:pref]
@user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
if @user.save
if @user.auth_source and @user.auth_source.respond_to?('update')
@user.auth_source.update(@user.login, @user.firstname, @user.lastname, @user.mail)
end
@user.pref.save
@user.notified_project_ids = (params[:notification_option] == 'selected' ? params[:notified_project_ids] : [])
set_language_if_valid @user.language
redmine-0.9.0.new/app/models/auth_source_ldap.rb 2009-07-14 12:50:47.409859537 +0200
rescue LDAP::Error => text
raise "LDAP Auth Error: " + text
end
def update(login, firstname, lastname, mail)
ldap_con = initialize_ldap_con(self.account, self.account_password)
entry = [
LDAP.mod(LDAP::LDAP_MOD_REPLACE, self.attr_firstname, [firstname]),
LDAP.mod(LDAP::LDAP_MOD_REPLACE, self.attr_lastname, [lastname]),
LDAP.mod(LDAP::LDAP_MOD_REPLACE, self.attr_mail, [mail])
]
if self.filter.empty?
filter = self.attr_login + "=" + encode(login)
else
filter = self.filter.gsub("$login", encode(login))
end
ldap_con.modify(filter + "," + self.base_dn, entry)
rescue LDAP::Error => text
raise "LDAP Auth Error: " + text
end
# test the connection to the LDAP
def test_connection
(3-3/9)