Re-add support for attribute ranges
This is an alternative implementation of #37 . It doesn't need additional configuration, but enables range retrieval automatic. It also add some testing. Fixes #32
This commit is contained in:
4
test/fixtures/ldapdb.yaml
vendored
4
test/fixtures/ldapdb.yaml
vendored
@ -2,6 +2,9 @@
|
||||
dc=example,dc=com:
|
||||
cn:
|
||||
- Top object
|
||||
cn=Unknown Flintstone,dc=example,dc=com:
|
||||
cn:
|
||||
- Unknown Flintstone
|
||||
cn=Fred Flintstone,dc=example,dc=com:
|
||||
cn:
|
||||
- Fred Flintstone
|
||||
@ -36,3 +39,4 @@ cn=All Users,dc=example,dc=com:
|
||||
member:
|
||||
- cn=Wilmas,dc=example,dc=com
|
||||
- cn=Fred Flintstone,dc=example,dc=com
|
||||
- cn=Unknown Flintstone,dc=example,dc=com
|
||||
|
@ -17,11 +17,10 @@ class HashOperation < LDAP::Server::Operation
|
||||
|
||||
def search(basedn, scope, deref, filter)
|
||||
basedn.downcase!
|
||||
|
||||
case scope
|
||||
when LDAP::Server::BaseObject
|
||||
# client asked for single object by DN
|
||||
obj = @hash[basedn]
|
||||
obj = @hash.transform_keys(&:downcase)[basedn]
|
||||
raise LDAP::ResultError::NoSuchObject unless obj
|
||||
send_SearchResultEntry(basedn, obj) if LDAP::Server::Filter.run(filter, obj)
|
||||
|
||||
|
@ -41,7 +41,8 @@ class TestPgLdapSync < Minitest::Test
|
||||
# :ssl_cert_file => "cert.pem",
|
||||
# :ssl_on_connect => true,
|
||||
:operation_class => HashOperation,
|
||||
:operation_args => @directory
|
||||
:operation_args => @directory,
|
||||
:attribute_range_limit => 2
|
||||
)
|
||||
@ldap_server.run_tcpserver
|
||||
end
|
||||
@ -122,7 +123,7 @@ class TestPgLdapSync < Minitest::Test
|
||||
end
|
||||
|
||||
def sync_with_config(config="config-ldapdb")
|
||||
PgLdapSync::Application.run(["-c", "test/fixtures/#{config}.yaml"] + ($DEBUG ? ["-vv"] : ["--no-verbose"]))
|
||||
PgLdapSync::Application.run(["-c", "test/fixtures/#{config}.yaml"] + ($DEBUG ? ["-vvv"] : ["--no-verbose"]))
|
||||
end
|
||||
|
||||
def sync_to_fixture(fixture: "ldapdb", config: "config-ldapdb")
|
||||
|
Reference in New Issue
Block a user