iredmail / iRedAdmin

iRedMail Admin Panel (Open Source Edition)
https://www.iredmail.org/admin_panel.html
GNU General Public License v2.0
77 stars 28 forks source link

Deleting domain causes all forwardings to be deleted aswell #18

Closed Anzulo1984 closed 2 years ago

Anzulo1984 commented 2 years ago

Reference:

https://forum.iredmail.org/post82395.html#p82395

Just deleting a domain should not cascade all references in vmail.forwardings that point to the deleted domain, since it doesn't matter if the forwarded domain is locally hosted or not.

Either remove that completely or make it a checkbox with a warning like "delete all forwardings pointing to that domain aswell?" so ppl have the choice to do so if they want

iredmail commented 2 years ago

Confirmed and will fix in next release. Thank you very much for the report. :)

iredmail commented 2 years ago

This issue has been fixed moment ago, and will be available in next iRedAdmin-Pro release. Here's the patch for iRedAdmin-Pro-SQL-5.0. iRedAdmin-Pro customers (with valid license) can contact us (https://www.iredmail.org/contact.html) to get a patched version.

diff --git a/libs/sqllib/domain.py b/libs/sqllib/domain.py
index f9dd4573..44fd0508 100644
--- a/libs/sqllib/domain.py
+++ b/libs/sqllib/domain.py
@@ -680,21 +680,6 @@ def delete_domains(domains,
                         vars=sql_vars,
                         where='domain IN $domains')

-        # Delete destination domain name.
-        for tbl in ['forwardings', 'moderators']:
-            conn.delete(tbl,
-                        vars=sql_vars,
-                        where='dest_domain IN $domains')
-
-        # Introduced AFTER iRedMail-1.3.2.
-        for tbl in ['maillist_owners']:
-            try:
-                conn.delete(tbl,
-                            vars=sql_vars,
-                            where='domain IN $domains OR dest_domain IN $domains')
-            except:
-                pass
-
         # Delete alias domain
         conn.delete('alias_domain',
                     vars=sql_vars,