test_dummy.rb 1.08 KB
require 'SystemDataBackend'
require 'SystemDataBackendLdap'

backend = SystemDataBackend.new(
  SystemDataBackendLdap.new('host.one.virtual', 389, 'dc=weird-web-workers,dc=org')
)

backend.users.each do |user|
  puts 'user: '+user.name+','+user.uid+','+user.gid+','+user.home
end

puts

backend.groups.each do |group|
	members = backend.usersInGroup(group)

  puts 'group: '+group.name+','+group.gid
	puts '  members:'
  group.members.each do |name|
    print '   ' + name + ': '
		print members[name].uid + ', ' + members[name].home if members[name]
		puts
  end
  puts
end

backend.sites.each do |site|
  puts 'site: ' + site.name
  puts '  MailAliases:'
  backend.mailAliasesBySite(site).each{|account| puts '   ' + account.mail}
  puts
  puts '  MailAccounts:'
  backend.mailAccountsBySite(site).each{|account| puts '   ' + account.mail}
  puts
end

backend.mailAliases.each do |mailAlias|
  puts 'mailAlias: '+mailAlias.mail.inspect+','+mailAlias.maildrop.inspect
end

puts

backend.mailAccounts.each do |mailAccount|
  puts 'mailAccount: '+mailAccount.mail.inspect+','+mailAccount.mailbox.inspect
end