Skip to content

split email_users

o@ungehorsam.ch requested to merge splitEmailUsersTable into master

splitting our good old EmailUser table:

  • An EmailIadress (for ingress/immerda address) is an address we accept mail for. This record owns the associated email_object through a polymorphic association.

These are the possible email objects:

  • an EmailUser (email account)
  • an EmailAlias, an alternative ingress email for an email account.
  • EmailSchleuder or EmailMailman

Finally, an EmailForward routes from one EmailIaddress to a target address which can be any internal/external address, represented as string (for uniformity).

Cleanup works as follows:

  • Destroying an Iaddress marks it as deleted to prevent address reuse. And:
    • If the email_object is an EmailUser, we keep it around to be able to restore it
    • All other email objects are user editable resources, which have their own Resource::recover method. Thus we destroy them eagerly.
    • Any EmailForward on the address is destroyed.
  • Destroying an EmailForward, destroys the EmailIaddress, only if there is no other forward and no mail_object.

The EmailForward table gives us the full flexibility and therefore allows us to fully migrate what we have now. There is a validation that prevents circles and invalid internal targets.

This comes with some small associated changes to the user interface. Also it breaks some socket access by puppet/itools. But it provides the necessary new apis (mail_management/ensure_(forward|mailbox) to fix them afterwards.

Edited by o@ungehorsam.ch

Merge request reports