This commit is contained in:
Virtuworks 2015-03-06 08:08:11 -05:00
commit a617e94d79
19 changed files with 184 additions and 102 deletions

View file

@ -499,19 +499,22 @@ namespace WebsitePanel.EnterpriseServer
var collection = ObjectUtils.FillObjectFromDataReader<RdsCollection>(DataProvider.GetRDSCollectionById(collectionId));
var settings = ObjectUtils.FillObjectFromDataReader<RdsCollectionSettings>(DataProvider.GetRdsCollectionSettingsByCollectionId(collectionId));
if (settings.SecurityLayer == null)
if (settings != null)
{
settings.SecurityLayer = SecurityLayerValues.Negotiate.ToString();
}
if (settings.SecurityLayer == null)
{
settings.SecurityLayer = SecurityLayerValues.Negotiate.ToString();
}
if (settings.EncryptionLevel == null)
{
settings.EncryptionLevel = EncryptionLevel.ClientCompatible.ToString();
}
if (settings.EncryptionLevel == null)
{
settings.EncryptionLevel = EncryptionLevel.ClientCompatible.ToString();
}
if (settings.AuthenticateUsingNLA == null)
{
settings.AuthenticateUsingNLA = true;
if (settings.AuthenticateUsingNLA == null)
{
settings.AuthenticateUsingNLA = true;
}
}
return settings;
@ -532,9 +535,23 @@ namespace WebsitePanel.EnterpriseServer
private static int AddRdsCollectionInternal(int itemId, RdsCollection collection)
{
var result = TaskManager.StartResultTask<ResultObject>("REMOTE_DESKTOP_SERVICES", "ADD_RDS_COLLECTION");
var domainName = IPGlobalProperties.GetIPGlobalProperties().DomainName;
try
{
foreach(var server in collection.Servers)
{
if (!server.FqdName.EndsWith(domainName, StringComparison.CurrentCultureIgnoreCase))
{
throw TaskManager.WriteError(new Exception("Fully Qualified Domain Name not valid."));
}
if (!CheckRDSServerAvaliable(server.FqdName))
{
throw TaskManager.WriteError(new Exception(string.Format("Unable to connect to {0} server.", server.FqdName)));
}
}
// load organization
Organization org = OrganizationController.GetOrganization(itemId);
if (org == null)
@ -822,7 +839,7 @@ namespace WebsitePanel.EnterpriseServer
FillRdsServerData(tmpServer);
}
result.Servers = tmpServers.ToArray();
result.Servers = tmpServers.ToArray();
return result;
}
@ -1016,25 +1033,22 @@ namespace WebsitePanel.EnterpriseServer
{
if (CheckRDSServerAvaliable(rdsServer.FqdName))
{
rdsServer.Id = DataProvider.AddRDSServer(rdsServer.Name, rdsServer.FqdName, rdsServer.Description);
var domainName = IPGlobalProperties.GetIPGlobalProperties().DomainName;
if (rdsServer.FqdName.EndsWith(domainName, StringComparison.CurrentCultureIgnoreCase))
{
rdsServer.Id = DataProvider.AddRDSServer(rdsServer.Name, rdsServer.FqdName, rdsServer.Description);
}
else
{
throw TaskManager.WriteError(new Exception("Fully Qualified Domain Name not valid."));
}
}
else
{
result.AddError("REMOTE_DESKTOP_SERVICES_ADD_RDS_SERVER", new Exception("The server that you are adding, is not available"));
return result;
throw TaskManager.WriteError(new Exception(string.Format("Unable to connect to {0} server. Please double check Server Full Name setting and retry.", rdsServer.FqdName)));
}
}
catch (Exception ex)
{
if (ex.InnerException != null)
{
result.AddError("Unable to add RDS Server", ex.InnerException);
}
else
{
result.AddError("Unable to add RDS Server", ex);
}
}
}
finally
{
if (!result.IsSuccess)
@ -1753,7 +1767,7 @@ namespace WebsitePanel.EnterpriseServer
{
bool result = false;
var ping = new Ping();
var reply = ping.Send(hostname, 1000);
var reply = ping.Send(hostname, 1000);
if (reply.Status == IPStatus.Success)
{
@ -1761,8 +1775,7 @@ namespace WebsitePanel.EnterpriseServer
}
return result;
}
}
private static ResultObject DeleteRemoteDesktopServiceInternal(int itemId)
{
@ -1811,7 +1824,7 @@ namespace WebsitePanel.EnterpriseServer
private static RemoteDesktopServices GetRemoteDesktopServices(int serviceId)
{
var rds = new RemoteDesktopServices();
ServiceProviderProxy.Init(rds, serviceId);
ServiceProviderProxy.Init(rds, serviceId);
return rds;
}