tester.rb 1.22 KB
require 'ds_admin'

config = DsAdmin::Storage::Config.new(File.dirname(__FILE__) + '/config/storage.yml')
DsAdmin::Model.storage = DsAdmin::Storage::Ldap.new(config)

user         = DsAdmin::Model::User.new
group        = DsAdmin::Model::Group.new
site         = DsAdmin::Model::Site.new
alias_role   = DsAdmin::Model::MailAliasRole.new
alias_person = DsAdmin::Model::MailAliasPerson.new
account      = DsAdmin::Model::MailAccount.new

puts '=== DsAdmin each ==='
user.each {|user| puts user.inspect}
puts '---'
group.each {|group| puts group.inspect}
puts '---'
site.each {|site| puts site.inspect}
puts '---'
alias_role.each {|ma_role| puts ma_role.inspect}
puts '---'
alias_person.each {|ma_person| puts ma_person.inspect}
puts '---'
account.each {|macc| puts macc.inspect}

puts
puts '=== DsAdmin Enumerable ==='
puts user.find {|user| user.uid == '1000'}.inspect
puts '---'
puts group.find {|group| group.gid == '10'}.inspect
puts '---'
puts site.find {|site| site.name == 'steffers.org'}.inspect
puts '---'
puts alias_role.find_all {|mar| mar.maildrop == 'abuse'}.inspect
puts '---'
puts alias_person.find {|map| map.mail == 'georg@steffers.org'}.inspect
puts '---'
puts account.find {|acc| acc.mail == 'drachenfrau@steffers.org'}.inspect