split email_users
splitting our good old EmailUser table:
- An
EmailIadress(for ingress/immerda address) is an address we accept mail for. This record owns the associatedemail_objectthrough a polymorphic association.
These are the possible email objects:
- an
EmailUser(email account) - an
EmailAlias, an alternative ingress email for an email account. -
EmailSchleuderorEmailMailman
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
Iaddressmarks 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::recovermethod. Thus we destroy them eagerly. - Any
EmailForwardon the address is destroyed.
- Destroying an
EmailForward, destroys theEmailIaddress, only if there is no other forward and nomail_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