example/posix.rb in dm-ldap-adapter-0.3.5 vs example/posix.rb in dm-ldap-adapter-0.4.0.alpha2

- old
+ new

@@ -29,11 +29,11 @@ :adapter => 'ldap', :host => 'localhost', :port => '389', :base => ENV['LDAP_BASE'] || "dc=example,dc=com", :bind_name => "cn=admin," + (ENV['LDAP_BASE'] || "dc=example,dc=com"), - :password => ENV['LDAP_PWD'] || "behappy" + :password => ENV['LDAP_PWD'] || "behappy" }) else require 'dummy_ldap_resource' DataMapper.setup(:default, 'sqlite3::memory:') adapter = DataMapper.repository.adapter @@ -99,15 +99,15 @@ class Group include DataMapper::Resource include Slf4r::Logger property :id, Serial, :field => "gidnumber" property :name, String, :field => "cn" - + dn_prefix { |group| "cn=#{group.name}" } - + treebase "ou=groups" - + ldap_properties {{ :objectclass => "posixGroup"}} def users users = GroupUser.all(:gidnumber => id).collect{ |gu| gu.user } def users.group=(group) @@ -129,20 +129,20 @@ end end users end end - + class GroupUser include DataMapper::Resource include Slf4r::Logger - + dn_prefix { |group_user| "cn=#{group_user.group.name}" } - + treebase "ou=groups" - + multivalue_field :memberuid - + ldap_properties do |group_user| {:cn=>"#{group_user.group.name}", :objectclass => "posixGroup"} end property :memberuid, String, :key => true#, :field => "memberuid" property :gidnumber, Integer, :key => true#, :field => "gidnumber"