Commit 5e68b108e2013f4d16c6e5bf575f33da969e28d9

Authored by Georg GH. Hopp
Committed by Georg Hopp
1 parent b488bbe9

the model part is functionally final. Structuring, testing, bugfinding and debugging still needed

... ... @@ -185,8 +185,12 @@
185 185 "cn=#{data[:name]},ou=group,#{ldapBase(kind)}"
186 186 when :Site
187 187 "o=#{data[:name]},#{ldapBase(kind)}"
188   - else
189   - "not yet implemented"
  188 + when :MailAliasRole
  189 + "cn=#{data[:user]},o=#{data[:mail].sub(/.*@/, '')},#{ldapBase(kind)}"
  190 + when :MailAliasPerson
  191 + "mail=#{data[:mail]},o=#{data[:mail].sub(/.*@/, '')},#{ldapBase(kind)}"
  192 + when :MailAccount
  193 + "mail=#{data[:mail]},o=#{data[:mail].sub(/.*@/, '')},#{ldapBase(kind)}"
190 194 end
191 195 end
192 196
... ...
1 1 require 'SystemDataBackend'
2 2 require 'SystemDataBackendLdap'
3 3
4   -backend = SystemDataBackend.new(
5   - SystemDataBackendLdap.new('host.one.virtual', 389, 'dc=weird-web-workers,dc=org')
  4 +ldap = SystemDataBackendLdap.new(
  5 + 'host.one.virtual',
  6 + 389,
  7 + 'dc=weird-web-workers,dc=org'
6 8 )
  9 +backend = SystemDataBackend.new(ldap)
7 10
8 11 backend.users.each do |user|
9 12 puts 'user: '+user.name+','+user.uid+','+user.gid+','+user.home
... ... @@ -38,13 +41,13 @@ backend.sites.each do |site|
38 41 end
39 42
40 43 backend.mailAliasRoles.each do |mailAlias|
41   - puts 'mailAlias: '+mailAlias.mail.inspect+','+mailAlias.maildrop.inspect
  44 + puts 'mailAliasRole: '+mailAlias.mail.inspect+','+mailAlias.maildrop.inspect
42 45 end
43 46
44 47 puts
45 48
46 49 backend.mailAliasPeople.each do |mailAlias|
47   - puts 'mailAlias: '+mailAlias.mail.inspect+','+mailAlias.maildrop.inspect
  50 + puts 'mailAliasPerson: '+mailAlias.mail.inspect+','+mailAlias.maildrop.inspect
48 51 end
49 52
50 53 puts
... ... @@ -82,3 +85,34 @@ puts
82 85
83 86 site.name = 'wumbaba.de'
84 87 site.save
  88 +
  89 +puts
  90 +
  91 +mail = MailAliasRole.new({
  92 + :backend => ldap,
  93 + :mail => 'newrole@kommandozeilenchef.de',
  94 + :maildrop => 'newrole',
  95 + :user => 'newrole'
  96 +})
  97 +mail.save
  98 +
  99 +puts
  100 +
  101 +mail = MailAliasPerson.new({
  102 + :backend => ldap,
  103 + :mail => 'ohotte@kommandozeilenchef.de',
  104 + :maildrop => 'ohotte',
  105 + :name => 'Onkel Hotte',
  106 + :surname => 'Hotte'
  107 +})
  108 +mail.save
  109 +
  110 +puts
  111 +
  112 +mail = MailAccount.new({
  113 + :backend => ldap,
  114 + :mail => 'foobar@kommandozeilenchef.de',
  115 + :mailbox => 'kommandozeilenchef.de/foobar',
  116 + :home => '/var/spool/vmail/domains'
  117 +})
  118 +mail.save
... ...
Please register or login to post a comment