Fixes error message for LDAP filter (#1060).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9258 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
ee8002b0c9
commit
5663ca89fa
@ -29,6 +29,14 @@ class AuthSourceLdap < AuthSource
|
|||||||
|
|
||||||
before_validation :strip_ldap_attributes
|
before_validation :strip_ldap_attributes
|
||||||
|
|
||||||
|
def self.human_attribute_name(attribute_key_name, *args)
|
||||||
|
attr_name = attribute_key_name.to_s
|
||||||
|
if attr_name == "filter"
|
||||||
|
attr_name = "ldap_filter"
|
||||||
|
end
|
||||||
|
super(attr_name, *args)
|
||||||
|
end
|
||||||
|
|
||||||
def initialize(attributes=nil, *args)
|
def initialize(attributes=nil, *args)
|
||||||
super
|
super
|
||||||
self.port = 389 if self.port == 0
|
self.port = 389 if self.port == 0
|
||||||
|
@ -51,7 +51,7 @@ class AuthSourceLdapTest < ActiveSupport::TestCase
|
|||||||
a = AuthSourceLdap.new(:name => 'My LDAP', :host => 'ldap.example.net', :port => 389, :attr_login => 'sn')
|
a = AuthSourceLdap.new(:name => 'My LDAP', :host => 'ldap.example.net', :port => 389, :attr_login => 'sn')
|
||||||
a.filter = "(mail=*@redmine.org"
|
a.filter = "(mail=*@redmine.org"
|
||||||
assert !a.valid?
|
assert !a.valid?
|
||||||
assert_include "is invalid", a.errors[:filter]
|
assert_include "LDAP filter is invalid", a.errors.full_messages
|
||||||
|
|
||||||
a.filter = "(mail=*@redmine.org)"
|
a.filter = "(mail=*@redmine.org)"
|
||||||
assert a.valid?
|
assert a.valid?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user