README.txt in dm-ldap-adapter-0.3.3 vs README.txt in dm-ldap-adapter-0.3.4
- old
+ new
@@ -14,14 +14,36 @@
the usecase for that implementation was using an ldap server for user authentication and authorization. the ldap server is configured to have posixAccounts and posixGroups. on the datamapper side these accounts/groups are modeled with many-to-many relationship. further more the model classes should be in such a way that they can be used with another repository as well, i.e. they carry some ldap related configuration but this is only relevant for the ldap-adapter.
=== low level ldap library
-the ldap library which does the actual ldap protocol stuff is [http://rubyforge.org/projects/net-ldap] which is the default. the other ldap library is [http://rubyforge.org/projects/ruby-ldap]. these libraries are behind a facade, if you want to use the ruby-ldap library you need to require the right facade before the ldap-adapter:
+the ldap library which does the actual ldap protocol stuff is [http://rubyforge.org/projects/net-ldap] which is the default. the other ldap library is [http://rubyforge.org/projects/ruby-ldap]. just add a facade parameter when setting up DataMapper
- require 'ldap/ruby_ldap_facade'
+ DataMapper.setup(:ldap, {
+ :adapter => 'ldap',
+ :facade => :ruby_ldap,
+ .... })
+or
+
+ DataMapper.setup(:ldap, {
+ :adapter => 'ldap',
+ :facade => :net_ldap,
+ .... })
+
+=== setup DataMapper
+
+ DataMapper.setup(:ldap, {
+ :adapter => 'ldap',
+ :host => 'localhost',
+ :port => '389',
+ :base => "dc=example,dc=com",
+ :facade => :ruby_ldap,
+ :bind_name => "cn=admin,dc=example,dc=com",
+ :password => "behappy"
+ })
+
=== examples
see 'example/posix.rb' for user/group setup works with default installation of openldap on ubuntu (just change your password as needed in the code)
the 'example/identity_map.rb' shows the usage of identity maps, see also below.
@@ -94,16 +116,10 @@
or-conditions can be done with :conditions option but only of the form "<property_name> <comparator> <value> [or <property_name> <comparator> <value>]*" where the comparator is one of "=", "like". it can be also combined with extra ANDs like this example
Contact.all(:name.like => "A%", :conditions => ["phone like '+49%' or mobile like '+49%'"])
-=== using the ruby-ldap gem
-
-just require the right facade before require the adapter:
-
- require 'ldap/ruby_ldap_facade'
-
=== multiple repositories
most probably you have to work with ldap as one repository and a database as a second repository. for me it worked best to define the `default_repository` for each model in the model itself:
class User
@@ -185,9 +201,10 @@
== REQUIREMENTS:
* slf4r the logging facade
* net-ldap pure ruby ldap library
+* ruby-ldap (optional) ruby with native ldap code
* logging (optional) if logging via logging is desired
* log4r (optional) if logging via log4r is desired
== INSTALL: