test_dummy.rb
1.61 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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 ' MailAliasRoles:'
backend.mailAliasRolesBySite(site).each{|account| puts ' ' + account.mail}
puts
puts ' MailAliasPeople:'
backend.mailAliasPeopleBySite(site).each{|account| puts ' ' + account.mail}
puts
puts ' MailAccounts:'
backend.mailAccountsBySite(site).each{|account| puts ' ' + account.mail}
puts
end
backend.mailAliasRoles.each do |mailAlias|
puts 'mailAlias: '+mailAlias.mail.inspect+','+mailAlias.maildrop.inspect
end
puts
backend.mailAliasPeople.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
puts
georg = backend.userByName('georg')
georg.save
puts
georg.uid = 1001
georg.save
puts
wheel = backend.groupByName('wheel')
wheel.save
puts
wheel.gid = 100
wheel.save
puts
site = backend.siteByName('kommandozeilenchef.de')
site.save
puts
site.name = 'wumbaba.de'
site.save