From 1c7d232f7cbb0b9a4194a5c87d9bd4098a45a3e6 Mon Sep 17 00:00:00 2001 From: robvde Date: Sun, 18 Nov 2012 13:46:58 +0400 Subject: [PATCH] Fixed: When a domain is assigned to an email domain as an alias, you are still able to create and assign email accounts under that domain --- .../WebsitePanel.EnterpriseServer/Web.config | 4 +-- .../DomainsSelectDomainControl.ascx.cs | 34 +++++++++++++++++++ .../WebsitePanel/MailEditAddress.ascx | 2 +- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config index c48ebaf1..893524ff 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config @@ -9,7 +9,7 @@ --> - + @@ -17,7 +17,7 @@ --> - + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsSelectDomainControl.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsSelectDomainControl.ascx.cs index cc723f6a..7c52e8f0 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsSelectDomainControl.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsSelectDomainControl.ascx.cs @@ -62,6 +62,13 @@ namespace WebsitePanel.Portal set { ViewState["HideMailDomains"] = value; } } + public bool HideMailDomainPointers + { + get { return (ViewState["HideMailDomainPointers"] != null) ? (bool)ViewState["HideMailDomainPointers"] : false; } + set { ViewState["HideMailDomainPointers"] = value; } + } + + public bool HideDomainPointers { get { return (ViewState["HideDomainPointers"] != null) ? (bool)ViewState["HideDomainPointers"] : false; } @@ -111,6 +118,7 @@ namespace WebsitePanel.Portal WebSite[] sites = null; Hashtable htSites = new Hashtable(); + Hashtable htMailDomainPointers = new Hashtable(); if (HideWebSites) { sites = ES.Services.WebServers.GetWebSites(PackageId, false); @@ -127,6 +135,25 @@ namespace WebsitePanel.Portal } } + if (HideMailDomainPointers) + { + Providers.Mail.MailDomain[] mailDomains = ES.Services.MailServers.GetMailDomains(PackageId, false); + + foreach (Providers.Mail.MailDomain mailDomain in mailDomains) + { + DomainInfo[] pointers = ES.Services.MailServers.GetMailDomainPointers(mailDomain.Id); + if (pointers != null) + { + foreach (DomainInfo p in pointers) + { + if (htMailDomainPointers[p.DomainName.ToLower()] == null) htMailDomainPointers.Add(p.DomainName.ToLower(), 1); + + } + } + } + } + + ddlDomains.Items.Clear(); // add "select" item @@ -148,6 +175,13 @@ namespace WebsitePanel.Portal } } } + + + if (HideMailDomainPointers) + { + if (htMailDomainPointers[domain.DomainName.ToLower()] != null) continue; + } + if (HideInstantAlias && domain.IsInstantAlias) continue; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/MailEditAddress.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/MailEditAddress.ascx index bb808b7a..6037cbc1 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/MailEditAddress.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/MailEditAddress.ascx @@ -9,7 +9,7 @@  @  - +