Merge
This commit is contained in:
commit
ec856b89f2
120 changed files with 2867 additions and 841 deletions
|
@ -102,7 +102,6 @@ namespace WebsitePanel.EnterpriseServer
|
|||
if (allowEmptyValue)
|
||||
{
|
||||
if (String.IsNullOrEmpty(str)) return str;
|
||||
if (String.IsNullOrEmpty(value)) return string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -33,6 +33,7 @@ using System.Data.SqlClient;
|
|||
using System.Text.RegularExpressions;
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
using Microsoft.ApplicationBlocks.Data;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebsitePanel.EnterpriseServer
|
||||
{
|
||||
|
@ -2152,6 +2153,18 @@ namespace WebsitePanel.EnterpriseServer
|
|||
);
|
||||
}
|
||||
|
||||
public static void ChangeExchangeAcceptedDomainType(int itemId, int domainId, int domainTypeId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"ChangeExchangeAcceptedDomainType",
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@DomainID", domainId),
|
||||
new SqlParameter("@DomainTypeID", domainTypeId)
|
||||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetExchangeOrganizationStatistics(int itemId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
|
@ -3399,5 +3412,45 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
#endregion
|
||||
|
||||
public static int GetPackageIdByName(string Name)
|
||||
{
|
||||
// get Helicon Zoo provider
|
||||
int packageId = -1;
|
||||
List<ProviderInfo> providers = ServerController.GetProviders();
|
||||
foreach (ProviderInfo providerInfo in providers)
|
||||
{
|
||||
if (string.Equals(Name, providerInfo.ProviderName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
packageId = providerInfo.ProviderId;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (-1 == packageId)
|
||||
{
|
||||
throw new Exception("Provider not found");
|
||||
}
|
||||
|
||||
return packageId;
|
||||
}
|
||||
|
||||
public static int GetServiceIdByProviderForServer(int providerId, int serverId)
|
||||
{
|
||||
IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.Text,
|
||||
@"SELECT TOP 1
|
||||
ServiceID
|
||||
FROM Services
|
||||
WHERE ProviderID = @ProviderID AND ServerID = @ServerID",
|
||||
new SqlParameter("@ProviderID", providerId),
|
||||
new SqlParameter("@ServerID", serverId));
|
||||
|
||||
if (reader.Read())
|
||||
{
|
||||
return (int)reader["ServiceID"];
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -284,7 +284,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
if (record.RecordType == "A" || record.RecordType == "AAAA")
|
||||
{
|
||||
rr.RecordData = String.IsNullOrEmpty(record.RecordData) ? record.ExternalIP : record.RecordData;
|
||||
rr.RecordData = Utils.ReplaceStringVariable(rr.RecordData, "ip", record.ExternalIP);
|
||||
rr.RecordData = Utils.ReplaceStringVariable(rr.RecordData, "ip", string.IsNullOrEmpty(serviceIP) ? record.ExternalIP : serviceIP);
|
||||
|
||||
if (String.IsNullOrEmpty(rr.RecordData) && !String.IsNullOrEmpty(serviceIP))
|
||||
rr.RecordData = serviceIP;
|
||||
|
@ -310,7 +310,10 @@ namespace WebsitePanel.EnterpriseServer
|
|||
rr.MxPriority = record.MxPriority;
|
||||
|
||||
if (!String.IsNullOrEmpty(rr.RecordData))
|
||||
zoneRecords.Add(rr);
|
||||
{
|
||||
if (rr.RecordName != "[host_name]")
|
||||
zoneRecords.Add(rr);
|
||||
}
|
||||
}
|
||||
|
||||
return zoneRecords;
|
||||
|
|
|
@ -446,6 +446,10 @@ namespace WebsitePanel.EnterpriseServer
|
|||
{
|
||||
hubTransportRole.AddAuthoritativeDomain(domain.DomainName);
|
||||
}
|
||||
if (domain.DomainType != ExchangeAcceptedDomainType.Authoritative)
|
||||
{
|
||||
hubTransportRole.ChangeAcceptedDomainType(domain.DomainName, domain.DomainType);
|
||||
}
|
||||
}
|
||||
authDomainCreated = true;
|
||||
break;
|
||||
|
@ -1423,8 +1427,64 @@ namespace WebsitePanel.EnterpriseServer
|
|||
TaskManager.CompleteTask();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static int ChangeAcceptedDomainType(int itemId, int domainId, ExchangeAcceptedDomainType domainType)
|
||||
{
|
||||
// check account
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
if (accountCheck < 0) return accountCheck;
|
||||
|
||||
// place log record
|
||||
TaskManager.StartTask("EXCHANGE", "CHANGE_DOMAIN_TYPE");
|
||||
TaskManager.TaskParameters["Domain ID"] = domainId;
|
||||
TaskManager.TaskParameters["Domain Type"] = domainType.ToString();
|
||||
TaskManager.ItemId = itemId;
|
||||
|
||||
try
|
||||
{
|
||||
// load organization
|
||||
Organization org = (Organization)PackageController.GetPackageItem(itemId);
|
||||
if (org == null)
|
||||
return -1;
|
||||
|
||||
// load domain
|
||||
DomainInfo domain = ServerController.GetDomain(domainId);
|
||||
if (domain == null)
|
||||
return -1;
|
||||
|
||||
int[] hubTransportServiceIds;
|
||||
int[] clientAccessServiceIds;
|
||||
int exchangeServiceId = GetExchangeServiceID(org.PackageId);
|
||||
GetExchangeServices(exchangeServiceId, out hubTransportServiceIds, out clientAccessServiceIds);
|
||||
|
||||
foreach (int id in hubTransportServiceIds)
|
||||
{
|
||||
ExchangeServer hubTransportRole = null;
|
||||
try
|
||||
{
|
||||
hubTransportRole = GetExchangeServer(id, org.ServiceId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TaskManager.WriteError(ex);
|
||||
continue;
|
||||
}
|
||||
|
||||
hubTransportRole.ChangeAcceptedDomainType(domain.DomainName, domainType);
|
||||
break;
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
}
|
||||
|
||||
public static int DeleteAuthoritativeDomain(int itemId, int domainId)
|
||||
{
|
||||
|
|
|
@ -1042,6 +1042,37 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
}
|
||||
|
||||
public static int ChangeOrganizationDomainType(int itemId, int domainId, ExchangeAcceptedDomainType newDomainType)
|
||||
{
|
||||
// check account
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
if (accountCheck < 0) return accountCheck;
|
||||
|
||||
// place log record
|
||||
TaskManager.StartTask("ORGANIZATION", "CHANGE_DOMAIN_TYPE", domainId);
|
||||
TaskManager.ItemId = itemId;
|
||||
|
||||
try
|
||||
{
|
||||
// change accepted domain type on Exchange
|
||||
int checkResult = ExchangeServerController.ChangeAcceptedDomainType(itemId, domainId, newDomainType);
|
||||
|
||||
|
||||
// change accepted domain type in DB
|
||||
int domainTypeId= (int) newDomainType;
|
||||
DataProvider.ChangeExchangeAcceptedDomainType(itemId, domainId, domainTypeId);
|
||||
|
||||
return checkResult;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
}
|
||||
|
||||
public static int AddOrganizationDomain(int itemId, string domainName)
|
||||
{
|
||||
|
|
|
@ -41,6 +41,7 @@ using WebsitePanel.Providers.OS;
|
|||
using OS = WebsitePanel.Providers.OS;
|
||||
using System.Collections;
|
||||
|
||||
|
||||
namespace WebsitePanel.EnterpriseServer
|
||||
{
|
||||
public class OperatingSystemController : IImportController, IBackupController
|
||||
|
@ -409,6 +410,23 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
#region Web Platform Installer
|
||||
|
||||
public static bool CheckLoadUserProfile(int serverId)
|
||||
{
|
||||
int packageId = DataProvider.GetPackageIdByName("IIS70");
|
||||
int serviceId = DataProvider.GetServiceIdByProviderForServer(packageId, serverId);
|
||||
return WebServerController.GetWebServer(serviceId).CheckLoadUserProfile();
|
||||
|
||||
}
|
||||
|
||||
public static void EnableLoadUserProfile(int serverId)
|
||||
{
|
||||
int packageId = DataProvider.GetPackageIdByName("IIS70");
|
||||
int serviceId = DataProvider.GetServiceIdByProviderForServer(packageId, serverId);
|
||||
WebServerController.GetWebServer(serviceId).EnableLoadUserProfile();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void InitWPIFeeds(int serverId, string feedUrls)
|
||||
{
|
||||
GetServerService(serverId).InitWPIFeeds(feedUrls);
|
||||
|
@ -746,6 +764,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -481,7 +481,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
// create web site
|
||||
try
|
||||
{
|
||||
int webSiteId = WebServerController.AddWebSite(packageId, hostName, domainId, 0, true);
|
||||
int webSiteId = WebServerController.AddWebSite(packageId, hostName, domainId, 0, true, false);
|
||||
if (webSiteId < 0)
|
||||
{
|
||||
result.Result = webSiteId;
|
||||
|
|
|
@ -1729,7 +1729,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
int webSiteId = 0;
|
||||
if (webEnabled && createWebSite)
|
||||
{
|
||||
webSiteId = WebServerController.AddWebSite(packageId, hostName, domainId, 0, createInstantAlias);
|
||||
webSiteId = WebServerController.AddWebSite(packageId, hostName, domainId, 0, createInstantAlias, false);
|
||||
|
||||
if (webSiteId < 0)
|
||||
{
|
||||
|
@ -2005,7 +2005,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
|
||||
// delete zone if required
|
||||
DnsServerController.DeleteZone(domain.ZoneItemId);
|
||||
if (!domain.IsDomainPointer)
|
||||
DnsServerController.DeleteZone(domain.ZoneItemId);
|
||||
|
||||
// delete domain
|
||||
DataProvider.DeleteDomain(SecurityContext.User.UserId, domainId);
|
||||
|
|
|
@ -228,7 +228,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
"sp_dropsrvrolemember '{0}', 'dbcreator'\nGO", dbUser.Name));
|
||||
|
||||
// restore original web site bindings
|
||||
web.UpdateSiteBindings(site.SiteId, bindings);
|
||||
web.UpdateSiteBindings(site.SiteId, bindings, false);
|
||||
|
||||
// save statistics item
|
||||
item.ServiceId = serviceId;
|
||||
|
|
|
@ -199,7 +199,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
try
|
||||
{
|
||||
int webSiteId = WebServerController.AddWebSite(
|
||||
createdPackageId, hostName, domainId, 0, true);
|
||||
createdPackageId, hostName, domainId, 0, true, false);
|
||||
if (webSiteId < 0)
|
||||
{
|
||||
// rollback wizard
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue