tester.rb
1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
puts 'Memory useage: ' + `ps -o rss= -p #{Process.pid}`