Go MAEDA wrote:
r18692 changed AuthSourceLdap.get_attr method to private, but there are some codes that call AuthSourceLdap.get_attr. As a result, those codes raise NoMethodError and users cannot sign in with LDAP authentication.
[...]
I confirmed.
Reverting r18692 should fix this issue (I have not yet tested it).
I think you can revert, but the following patch confirmed that LDAP authentication works.
diff --git a/app/models/auth_source_ldap.rb b/app/models/auth_source_ldap.rb
index a1739c00e..546597e5d 100644
--- a/app/models/auth_source_ldap.rb
+++ b/app/models/auth_source_ldap.rb
@@ -103,7 +103,7 @@ class AuthSourceLdap < AuthSource
:attributes => ['dn', self.attr_login, self.attr_firstname, self.attr_lastname, self.attr_mail],
:size => 10) do |entry|
attrs = get_user_attributes_from_ldap_entry(entry)
- attrs[:login] = AuthSourceLdap.get_attr(entry, self.attr_login)
+ attrs[:login] = get_attr(entry, self.attr_login)
results << attrs
end
results
@@ -197,9 +197,9 @@ class AuthSourceLdap < AuthSource
def get_user_attributes_from_ldap_entry(entry)
{
:dn => entry.dn,
- :firstname => AuthSourceLdap.get_attr(entry, self.attr_firstname),
- :lastname => AuthSourceLdap.get_attr(entry, self.attr_lastname),
- :mail => AuthSourceLdap.get_attr(entry, self.attr_mail),
+ :firstname => get_attr(entry, self.attr_firstname),
+ :lastname => get_attr(entry, self.attr_lastname),
+ :mail => get_attr(entry, self.attr_mail),
:auth_source_id => self.id
}
end
@@ -244,11 +244,10 @@ class AuthSourceLdap < AuthSource
attrs
end
- def self.get_attr(entry, attr_name)
+ def get_attr(entry, attr_name)
if !attr_name.blank?
value = entry[attr_name].is_a?(Array) ? entry[attr_name].first : entry[attr_name]
value.to_s.force_encoding('UTF-8')
end
end
- private_class_method :get_attr
end