Merge tip of default branch

This commit is contained in:
VoosW 2012-11-06 18:35:24 +01:00
commit cac9401322
6 changed files with 127 additions and 31 deletions

View file

@ -559,6 +559,17 @@ GO
UPDATE [dbo].[ResourceGroups] SET ShowGroup=1
GO
IF NOT EXISTS(select 1 from sys.columns COLS INNER JOIN sys.objects OBJS ON OBJS.object_id=COLS.object_id and OBJS.type='U' AND OBJS.name='Quotas' AND COLS.name='ShowGroup')
BEGIN
ALTER TABLE [dbo].[Quotas] ADD [HideQuota] [bit] NULL
END
GO
UPDATE [dbo].[Quotas] SET [HideQuota] = 1 WHERE [QuotaName] = N'OS.DomainPointers'
GO
/****** Object: Table [dbo].[ExchangeAccounts] Extend Exchange Accounts with SubscriberNumber ******/
IF NOT EXISTS(select 1 from sys.columns COLS INNER JOIN sys.objects OBJS ON OBJS.object_id=COLS.object_id and OBJS.type='U' AND OBJS.name='Users' AND COLS.name='SubscriberNumber')
@ -3925,6 +3936,7 @@ SELECT
dbo.GetPackageAllocatedQuota(@PackageID, Q.QuotaID) AS ParentQuotaValue
FROM Quotas AS Q
LEFT OUTER JOIN HostingPlanQuotas AS HPQ ON Q.QuotaID = HPQ.QuotaID AND HPQ.PlanID = @PlanID
WHERE Q.HideQuota IS NULL OR Q.HideQuota = 0
ORDER BY Q.QuotaOrder
RETURN
GO
@ -6424,3 +6436,6 @@ BEGIN
INSERT [dbo].[ScheduleTaskParameters] ([TaskID], [ParameterID], [DataTypeID], [DefaultValue], [ParameterOrder]) VALUES (N'SCHEDULE_TASK_HOSTED_SOLUTION_REPORT', N'LYNC_REPORT', N'Boolean', N'true', 5)
END
GO

View file

@ -115,6 +115,7 @@ namespace WebsitePanel.EnterpriseServer
public const int ERROR_WEB_SITE_SHARED_IP_ADDRESS_NOT_SPECIFIED = -608;
public const int ERROR_WEB_SHARED_SSL_QUOTA_LIMIT = -609;
public const int ERROR_GLOBALDNS_FOR_DEDICATEDIP = -610;
public const int ERROR_PUBLICSHAREDIP_FOR_SHAREDIP = -611;
#endregion
#region Mail

View file

@ -1847,8 +1847,8 @@ namespace WebsitePanel.EnterpriseServer
else if (isDomainPointer)
{
// domain pointer
if (PackageController.GetPackageQuota(packageId, Quotas.OS_DOMAINPOINTERS).QuotaExhausted)
return BusinessErrorCodes.ERROR_DOMAIN_QUOTA_LIMIT;
//if (PackageController.GetPackageQuota(packageId, Quotas.OS_DOMAINPOINTERS).QuotaExhausted)
//return BusinessErrorCodes.ERROR_DOMAIN_QUOTA_LIMIT;
}
else
{
@ -2495,10 +2495,20 @@ namespace WebsitePanel.EnterpriseServer
instantAlias = GetDomainItem(instantAliasId);
}
string parentZone = domain.ZoneName;
if (string.IsNullOrEmpty(parentZone))
{
DomainInfo parentDomain = GetDomain(domain.DomainId);
parentZone = parentDomain.DomainName;
}
if (domain.WebSiteId > 0)
{
WebServerController.AddWebSitePointer(domain.WebSiteId,
(domain.DomainName.Replace("." + domain.ZoneName, "") == domain.ZoneName) ? "" : domain.DomainName.Replace("." + domain.ZoneName, ""),
((domain.DomainName.Replace("." + parentZone, "") == parentZone) |
(domain.DomainName == parentZone))
? "" : domain.DomainName.Replace("." + parentZone, ""),
instantAlias.DomainId);
}
@ -2507,12 +2517,14 @@ namespace WebsitePanel.EnterpriseServer
List<DomainInfo> domains = GetDomainsByDomainItemId(domain.DomainId);
foreach (DomainInfo d in domains)
{
if (d.WebSiteId > 0)
{
WebServerController.AddWebSitePointer(d.WebSiteId,
(d.DomainName.Replace("." + domain.ZoneName, "") == domain.ZoneName) ? "" : d.DomainName.Replace("." + domain.ZoneName, ""),
((d.DomainName.Replace("." + parentZone, "") == parentZone) |
(d.DomainName == parentZone))
? "" : d.DomainName.Replace("." + parentZone, ""),
instantAlias.DomainId);
}
}

View file

@ -172,15 +172,20 @@ namespace WebsitePanel.EnterpriseServer
return AddWebSite(packageId, hostName, domainId, ipAddressId, false, true);
}
private static Regex regIP = new Regex(
@"(?<First>2[0-4]\d|25[0-5]|[01]?\d\d?)\.(?<Second>2[0-4]\d|25"
+ @"[0-5]|[01]?\d\d?)\.(?<Third>2[0-4]\d|25[0-5]|[01]?\d\d?)\.(?"
+ @"<Fourth>2[0-4]\d|25[0-5]|[01]?\d\d?)",
RegexOptions.IgnoreCase
| RegexOptions.CultureInvariant
| RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled
);
private static bool IsValidIPAdddress(string addr)
{
System.Net.IPAddress ip;
if (System.Net.IPAddress.TryParse(addr, out ip))
{
return ((ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetworkV6) |
(ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork));
}
else
{
return false;
}
}
public static int AddWebSite(int packageId, string hostName, int domainId, int packageAddressId,
bool addInstantAlias, bool ignoreGlobalDNSRecords)
@ -270,14 +275,23 @@ namespace WebsitePanel.EnterpriseServer
if (dedicatedIp)
{
foreach (GlobalDnsRecord d in dnsRecords)
foreach (GlobalDnsRecord d in dnsRecords)
{
if (!string.IsNullOrEmpty(d.ExternalIP))
{
if (regIP.IsMatch(d.ExternalIP)) return BusinessErrorCodes.ERROR_GLOBALDNS_FOR_DEDICATEDIP;
}
if (!string.IsNullOrEmpty(d.ExternalIP))
{
if (!IsValidIPAdddress(d.ExternalIP)) return BusinessErrorCodes.ERROR_GLOBALDNS_FOR_DEDICATEDIP;
}
}
}
}
else
{
if (domain.ZoneItemId > 0)
{
StringDictionary settings = ServerController.GetServiceSettings(serviceId);
if (string.IsNullOrEmpty(settings["PublicSharedIP"]))
return BusinessErrorCodes.ERROR_PUBLICSHAREDIP_FOR_SHAREDIP;
}
}
// prepare site bindings
List<ServerBinding> bindings = new List<ServerBinding>();
@ -681,7 +695,7 @@ namespace WebsitePanel.EnterpriseServer
{
if (!string.IsNullOrEmpty(d.ExternalIP))
{
if (regIP.IsMatch(d.ExternalIP)) return BusinessErrorCodes.ERROR_GLOBALDNS_FOR_DEDICATEDIP;
if (!IsValidIPAdddress(d.ExternalIP)) return BusinessErrorCodes.ERROR_GLOBALDNS_FOR_DEDICATEDIP;
}
}
@ -695,7 +709,7 @@ namespace WebsitePanel.EnterpriseServer
// remove all web site pointers
DomainInfo domain = ServerController.GetDomain(siteItem.Name);
DomainInfo ZoneInfo = ServerController.GetDomain(domain.ZoneName);
DomainInfo ZoneInfo = ServerController.GetDomain(domain.DomainItemId);
if (ZoneInfo == null)
throw new Exception("Parent zone not found");
@ -761,18 +775,38 @@ namespace WebsitePanel.EnterpriseServer
// associate IP with web site
ServerController.AddItemIPAddress(siteItemId, ipAddressId);
string parentZone = domain.ZoneName;
if (string.IsNullOrEmpty(parentZone))
{
DomainInfo parentDomain = ServerController.GetDomain(domain.DomainItemId);
parentZone = parentDomain.DomainName;
}
AddWebSitePointer(siteItemId,
(domain.DomainName.Replace("." + domain.ZoneName, "") == domain.ZoneName) ? "": domain.DomainName.Replace("." + domain.ZoneName,"")
((domain.DomainName.Replace("." + parentZone, "") == parentZone) |
(domain.DomainName == parentZone))
? "" : domain.DomainName.Replace("." + parentZone, "")
, ZoneInfo.DomainId, true, true, true);
foreach (DomainInfo pointer in pointers)
{
ZoneInfo = ServerController.GetDomain(pointer.ZoneName);
string pointerParentZone = pointer.ZoneName;
if (string.IsNullOrEmpty(pointerParentZone))
{
DomainInfo parentDomain = ServerController.GetDomain(pointer.DomainItemId);
pointerParentZone = parentDomain.DomainName;
}
ZoneInfo = ServerController.GetDomain(pointerParentZone);
AddWebSitePointer(siteItemId,
(pointer.DomainName.Replace("." + pointer.ZoneName, "") == pointer.ZoneName) ? "" : pointer.DomainName.Replace("." + pointer.ZoneName, "")
((pointer.DomainName.Replace("." + pointerParentZone, "") == pointerParentZone) |
(pointer.DomainName == pointerParentZone))
? "" : pointer.DomainName.Replace("." + pointerParentZone, "")
, ZoneInfo.DomainId, true, true, true);
}
@ -839,6 +873,8 @@ namespace WebsitePanel.EnterpriseServer
if (siteItem == null)
return BusinessErrorCodes.ERROR_WEB_SITE_PACKAGE_ITEM_NOT_FOUND;
// place log record
TaskManager.StartTask("WEB_SITE", "SWITCH_TO_SHARED_IP", siteItem.Name);
TaskManager.ItemId = siteItemId;
@ -848,11 +884,20 @@ namespace WebsitePanel.EnterpriseServer
IPAddressInfo ip;
DomainInfo domain = ServerController.GetDomain(siteItem.Name);
DomainInfo ZoneInfo = ServerController.GetDomain(domain.ZoneName);
DomainInfo ZoneInfo = ServerController.GetDomain(domain.DomainItemId);
if (ZoneInfo == null)
throw new Exception("Parent zone not found");
if (ZoneInfo.ZoneItemId > 0)
{
StringDictionary settings = ServerController.GetServiceSettings(siteItem.ServiceId);
if (string.IsNullOrEmpty(settings["PublicSharedIP"]))
return BusinessErrorCodes.ERROR_PUBLICSHAREDIP_FOR_SHAREDIP;
}
//cleanup certificates
List<SSLCertificate> certificates = GetCertificatesForSite(siteItemId);
foreach (SSLCertificate c in certificates)
@ -931,16 +976,35 @@ namespace WebsitePanel.EnterpriseServer
siteItem.SiteIPAddressId = 0;
PackageController.UpdatePackageItem(siteItem);
string parentZone = domain.ZoneName;
if (string.IsNullOrEmpty(parentZone))
{
DomainInfo parentDomain = ServerController.GetDomain(domain.DomainItemId);
parentZone = parentDomain.DomainName;
}
AddWebSitePointer(siteItemId,
(domain.DomainName.Replace("." + domain.ZoneName, "") == domain.ZoneName) ? "" : domain.DomainName.Replace("." + domain.ZoneName, "")
((domain.DomainName.Replace("." + parentZone, "") == parentZone) |
(domain.DomainName == parentZone))
? "" : domain.DomainName.Replace("." + parentZone, "")
, ZoneInfo.DomainId, true, true, true);
foreach (DomainInfo pointer in pointers)
{
ZoneInfo = ServerController.GetDomain(pointer.ZoneName);
string pointerParentZone = pointer.ZoneName;
if (string.IsNullOrEmpty(pointerParentZone))
{
DomainInfo parentDomain = ServerController.GetDomain(pointer.DomainItemId);
pointerParentZone = parentDomain.DomainName;
}
ZoneInfo = ServerController.GetDomain(pointerParentZone);
AddWebSitePointer(siteItemId,
(pointer.DomainName.Replace("." + pointer.ZoneName, "") == pointer.ZoneName) ? "" : pointer.DomainName.Replace("." + pointer.ZoneName, "")
((pointer.DomainName.Replace("." + pointerParentZone, "") == pointerParentZone) |
(pointer.DomainName == pointerParentZone))
? "" : pointer.DomainName.Replace("." + pointerParentZone, "")
, ZoneInfo.DomainId, true, true, true);
}

View file

@ -1059,6 +1059,9 @@
<data name="Error.610" xml:space="preserve">
<value>Invalid Global DNS entries in platform server configuration for dedicated IP address usage. Contact you platform administrator</value>
</data>
<data name="Error.611" xml:space="preserve">
<value>Invalid public shared ip address in platform server configuration for shared IP address usage. Contact you platform administrator</value>
</data>
<data name="Error.700" xml:space="preserve">
<value>Specified mail domain already exists on the service</value>
</data>

View file

@ -148,7 +148,8 @@ namespace WebsitePanel.Portal
}
}
}
else if (HideInstantAlias && domain.IsInstantAlias)
if (HideInstantAlias && domain.IsInstantAlias)
continue;
else if (HideMailDomains && domain.MailDomainId > 0)
continue;