This commit is contained in:
vfedosevich 2015-03-09 03:17:25 -07:00
commit a0b63ba97d
59 changed files with 1746 additions and 376 deletions

View file

@ -5508,6 +5508,23 @@ CREATE TABLE [dbo].[RDSCollectionSettings](
GO
IF NOT EXISTS(SELECT * FROM SYS.TABLES WHERE name = 'RDSCertificates')
CREATE TABLE [dbo].[RDSCertificates](
[ID] [int] IDENTITY(1,1) NOT NULL,
[ServiceId] [int] NOT NULL,
[Content] [ntext] NOT NULL,
[Hash] [nvarchar](255) NOT NULL,
[FileName] [nvarchar](255) NOT NULL,
[ValidFrom] [datetime] NULL,
[ExpiryDate] [datetime] NULL
CONSTRAINT [PK_RDSCertificates] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[RDSCollectionUsers]
DROP CONSTRAINT [FK_RDSCollectionUsers_RDSCollectionId]
@ -5548,6 +5565,66 @@ GO
/*Remote Desktop Services Procedures*/
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddRDSCertificate')
DROP PROCEDURE AddRDSCertificate
GO
CREATE PROCEDURE [dbo].[AddRDSCertificate]
(
@RDSCertificateId INT OUTPUT,
@ServiceId INT,
@Content NTEXT,
@Hash NVARCHAR(255),
@FileName NVARCHAR(255),
@ValidFrom DATETIME,
@ExpiryDate DATETIME
)
AS
INSERT INTO RDSCertificates
(
ServiceId,
Content,
Hash,
FileName,
ValidFrom,
ExpiryDate
)
VALUES
(
@ServiceId,
@Content,
@Hash,
@FileName,
@ValidFrom,
@ExpiryDate
)
SET @RDSCertificateId = SCOPE_IDENTITY()
RETURN
GO
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSCertificateByServiceId')
DROP PROCEDURE GetRDSCertificateByServiceId
GO
CREATE PROCEDURE [dbo].[GetRDSCertificateByServiceId]
(
@ServiceId INT
)
AS
SELECT TOP 1
Id,
ServiceId,
Content,
Hash,
FileName,
ValidFrom,
ExpiryDate
FROM RDSCertificates
WHERE ServiceId = @ServiceId
ORDER BY Id DESC
GO
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddRDSServer')
DROP PROCEDURE AddRDSServer
GO
@ -6042,7 +6119,7 @@ CREATE PROCEDURE [dbo].GetOrganizationRdsUsersCount
)
AS
SELECT
@TotalNumber = Count([RDSCollectionId])
@TotalNumber = Count(DISTINCT([AccountId]))
FROM [dbo].[RDSCollectionUsers]
WHERE [RDSCollectionId] in (SELECT [ID] FROM [RDSCollections] where [ItemId] = @ItemId )
RETURN
@ -8192,6 +8269,22 @@ AS
INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
WHERE pt.ParentPackageID = @PackageID AND ea.AccountType = 11)
ELSE IF @QuotaID = 450
SET @Result = (SELECT COUNT(DISTINCT(RCU.[AccountId])) FROM [dbo].[RDSCollectionUsers] RCU
INNER JOIN ExchangeAccounts EA ON EA.AccountId = RCU.AccountId
INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
WHERE PT.ParentPackageID = @PackageID)
ELSE IF @QuotaID = 451
SET @Result = (SELECT COUNT(RS.[ID]) FROM [dbo].[RDSServers] RS
INNER JOIN ServiceItems si ON RS.ItemID = si.ItemID
INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
WHERE PT.ParentPackageID = @PackageID)
ELSE IF @QuotaID = 491
SET @Result = (SELECT COUNT(RC.[ID]) FROM [dbo].[RDSCollections] RC
INNER JOIN ServiceItems si ON RC.ItemID = si.ItemID
INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
WHERE PT.ParentPackageID = @PackageID)
ELSE IF @QuotaName like 'ServiceLevel.%' -- Support Service Level Quota
BEGIN
DECLARE @LevelID int

View file

@ -118,6 +118,12 @@ namespace WebsitePanel.EnterpriseServer {
private System.Threading.SendOrPostCallback SaveRdsCollectionLocalAdminsOperationCompleted;
private System.Threading.SendOrPostCallback InstallSessionHostsCertificateOperationCompleted;
private System.Threading.SendOrPostCallback GetRdsCertificateByServiceIdOperationCompleted;
private System.Threading.SendOrPostCallback AddRdsCertificateOperationCompleted;
/// <remarks/>
public esRemoteDesktopServices() {
this.Url = "http://localhost:9002/esRemoteDesktopServices.asmx";
@ -255,6 +261,15 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/>
public event SaveRdsCollectionLocalAdminsCompletedEventHandler SaveRdsCollectionLocalAdminsCompleted;
/// <remarks/>
public event InstallSessionHostsCertificateCompletedEventHandler InstallSessionHostsCertificateCompleted;
/// <remarks/>
public event GetRdsCertificateByServiceIdCompletedEventHandler GetRdsCertificateByServiceIdCompleted;
/// <remarks/>
public event AddRdsCertificateCompletedEventHandler AddRdsCertificateCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsCollection", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public RdsCollection GetRdsCollection(int collectionId) {
@ -2238,6 +2253,129 @@ namespace WebsitePanel.EnterpriseServer {
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/InstallSessionHostsCertificate", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public ResultObject InstallSessionHostsCertificate(RdsServer rdsServer) {
object[] results = this.Invoke("InstallSessionHostsCertificate", new object[] {
rdsServer});
return ((ResultObject)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginInstallSessionHostsCertificate(RdsServer rdsServer, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("InstallSessionHostsCertificate", new object[] {
rdsServer}, callback, asyncState);
}
/// <remarks/>
public ResultObject EndInstallSessionHostsCertificate(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((ResultObject)(results[0]));
}
/// <remarks/>
public void InstallSessionHostsCertificateAsync(RdsServer rdsServer) {
this.InstallSessionHostsCertificateAsync(rdsServer, null);
}
/// <remarks/>
public void InstallSessionHostsCertificateAsync(RdsServer rdsServer, object userState) {
if ((this.InstallSessionHostsCertificateOperationCompleted == null)) {
this.InstallSessionHostsCertificateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnInstallSessionHostsCertificateOperationCompleted);
}
this.InvokeAsync("InstallSessionHostsCertificate", new object[] {
rdsServer}, this.InstallSessionHostsCertificateOperationCompleted, userState);
}
private void OnInstallSessionHostsCertificateOperationCompleted(object arg) {
if ((this.InstallSessionHostsCertificateCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.InstallSessionHostsCertificateCompleted(this, new InstallSessionHostsCertificateCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsCertificateByServiceId", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public RdsCertificate GetRdsCertificateByServiceId(int serviceId) {
object[] results = this.Invoke("GetRdsCertificateByServiceId", new object[] {
serviceId});
return ((RdsCertificate)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetRdsCertificateByServiceId(int serviceId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetRdsCertificateByServiceId", new object[] {
serviceId}, callback, asyncState);
}
/// <remarks/>
public RdsCertificate EndGetRdsCertificateByServiceId(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((RdsCertificate)(results[0]));
}
/// <remarks/>
public void GetRdsCertificateByServiceIdAsync(int serviceId) {
this.GetRdsCertificateByServiceIdAsync(serviceId, null);
}
/// <remarks/>
public void GetRdsCertificateByServiceIdAsync(int serviceId, object userState) {
if ((this.GetRdsCertificateByServiceIdOperationCompleted == null)) {
this.GetRdsCertificateByServiceIdOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRdsCertificateByServiceIdOperationCompleted);
}
this.InvokeAsync("GetRdsCertificateByServiceId", new object[] {
serviceId}, this.GetRdsCertificateByServiceIdOperationCompleted, userState);
}
private void OnGetRdsCertificateByServiceIdOperationCompleted(object arg) {
if ((this.GetRdsCertificateByServiceIdCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetRdsCertificateByServiceIdCompleted(this, new GetRdsCertificateByServiceIdCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddRdsCertificate", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public ResultObject AddRdsCertificate(RdsCertificate certificate) {
object[] results = this.Invoke("AddRdsCertificate", new object[] {
certificate});
return ((ResultObject)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginAddRdsCertificate(RdsCertificate certificate, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("AddRdsCertificate", new object[] {
certificate}, callback, asyncState);
}
/// <remarks/>
public ResultObject EndAddRdsCertificate(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((ResultObject)(results[0]));
}
/// <remarks/>
public void AddRdsCertificateAsync(RdsCertificate certificate) {
this.AddRdsCertificateAsync(certificate, null);
}
/// <remarks/>
public void AddRdsCertificateAsync(RdsCertificate certificate, object userState) {
if ((this.AddRdsCertificateOperationCompleted == null)) {
this.AddRdsCertificateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddRdsCertificateOperationCompleted);
}
this.InvokeAsync("AddRdsCertificate", new object[] {
certificate}, this.AddRdsCertificateOperationCompleted, userState);
}
private void OnAddRdsCertificateOperationCompleted(object arg) {
if ((this.AddRdsCertificateCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.AddRdsCertificateCompleted(this, new AddRdsCertificateCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
@ -3387,4 +3525,82 @@ namespace WebsitePanel.EnterpriseServer {
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void InstallSessionHostsCertificateCompletedEventHandler(object sender, InstallSessionHostsCertificateCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class InstallSessionHostsCertificateCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal InstallSessionHostsCertificateCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public ResultObject Result {
get {
this.RaiseExceptionIfNecessary();
return ((ResultObject)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetRdsCertificateByServiceIdCompletedEventHandler(object sender, GetRdsCertificateByServiceIdCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetRdsCertificateByServiceIdCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetRdsCertificateByServiceIdCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public RdsCertificate Result {
get {
this.RaiseExceptionIfNecessary();
return ((RdsCertificate)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void AddRdsCertificateCompletedEventHandler(object sender, AddRdsCertificateCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class AddRdsCertificateCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal AddRdsCertificateCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public ResultObject Result {
get {
this.RaiseExceptionIfNecessary();
return ((ResultObject)(this.results[0]));
}
}
}
}

View file

@ -4676,6 +4676,37 @@ namespace WebsitePanel.EnterpriseServer
#region RDS
public static int AddRdsCertificate(int serviceId, string content, byte[] hash, string fileName, DateTime? validFrom, DateTime? expiryDate)
{
SqlParameter rdsCertificateId = new SqlParameter("@RDSCertificateID", SqlDbType.Int);
rdsCertificateId.Direction = ParameterDirection.Output;
SqlHelper.ExecuteNonQuery(
ConnectionString,
CommandType.StoredProcedure,
"AddRDSCertificate",
rdsCertificateId,
new SqlParameter("@ServiceId", serviceId),
new SqlParameter("@Content", content),
new SqlParameter("@Hash", Convert.ToBase64String(hash)),
new SqlParameter("@FileName", fileName),
new SqlParameter("@ValidFrom", validFrom),
new SqlParameter("@ExpiryDate", expiryDate)
);
return Convert.ToInt32(rdsCertificateId.Value);
}
public static IDataReader GetRdsCertificateByServiceId(int serviceId)
{
return SqlHelper.ExecuteReader(
ConnectionString,
CommandType.StoredProcedure,
"GetRDSCertificateByServiceId",
new SqlParameter("@ServiceId", serviceId)
);
}
public static IDataReader GetRdsCollectionSettingsByCollectionId(int collectionId)
{
return SqlHelper.ExecuteReader(

View file

@ -32,6 +32,7 @@ using System.Collections.Specialized;
using System.Globalization;
using System.Linq;
using System.Xml;
using System.Text;
using System.Xml.Serialization;
using WebsitePanel.Providers;
using WebsitePanel.Providers.DNS;
@ -385,7 +386,9 @@ namespace WebsitePanel.EnterpriseServer
var idn = new IdnMapping();
if (itemType == typeof(DnsZone))
items.AddRange(dns.GetZones().Select(z => idn.GetUnicode(z)));
items.AddRange(dns.GetZones().Select(z =>
Encoding.UTF8.GetByteCount(z) == z.Length ? // IsASCII
idn.GetUnicode(z) : z ));
return items;
}

View file

@ -278,6 +278,110 @@ namespace WebsitePanel.EnterpriseServer
return SaveRdsCollectionLocalAdminsInternal(users, collectionId);
}
public static ResultObject InstallSessionHostsCertificate(RdsServer rdsServer)
{
return InstallSessionHostsCertificateInternal(rdsServer);
}
public static RdsCertificate GetRdsCertificateByServiceId(int serviceId)
{
return GetRdsCertificateByServiceIdInternal(serviceId);
}
public static ResultObject AddRdsCertificate(RdsCertificate certificate)
{
return AddRdsCertificateInternal(certificate);
}
private static ResultObject InstallSessionHostsCertificateInternal(RdsServer rdsServer)
{
var result = TaskManager.StartResultTask<ResultObject>("REMOTE_DESKTOP_SERVICES", "INSTALL_CERTIFICATE");
try
{
Organization org = OrganizationController.GetOrganization(rdsServer.ItemId.Value);
if (org == null)
{
result.IsSuccess = false;
result.AddError("", new NullReferenceException("Organization not found"));
return result;
}
int serviceId = GetRemoteDesktopServiceID(org.PackageId);
var rds = GetRemoteDesktopServices(serviceId);
var certificate = GetRdsCertificateByServiceIdInternal(serviceId);
var array = Convert.FromBase64String(certificate.Hash);
char[] chars = new char[array.Length / sizeof(char)];
System.Buffer.BlockCopy(array, 0, chars, 0, array.Length);
string password = new string(chars);
byte[] content = Convert.FromBase64String(certificate.Content);
rds.InstallCertificate(content, password, new string[] {rdsServer.FqdName});
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
if (!result.IsSuccess)
{
TaskManager.CompleteResultTask(result);
}
else
{
TaskManager.CompleteResultTask();
}
}
return result;
}
private static RdsCertificate GetRdsCertificateByServiceIdInternal(int serviceId)
{
var result = ObjectUtils.FillObjectFromDataReader<RdsCertificate>(DataProvider.GetRdsCertificateByServiceId(serviceId));
return result;
}
private static ResultObject AddRdsCertificateInternal(RdsCertificate certificate)
{
var result = TaskManager.StartResultTask<ResultObject>("REMOTE_DESKTOP_SERVICES", "ADD_RDS_SERVER");
try
{
byte[] hash = new byte[certificate.Hash.Length * sizeof(char)];
System.Buffer.BlockCopy(certificate.Hash.ToCharArray(), 0, hash, 0, hash.Length);
certificate.Id = DataProvider.AddRdsCertificate(certificate.ServiceId, certificate.Content, hash, certificate.FileName, certificate.ValidFrom, certificate.ExpiryDate);
}
catch (Exception ex)
{
if (ex.InnerException != null)
{
result.AddError("Unable to add RDS Certificate", ex.InnerException);
}
else
{
result.AddError("Unable to add RDS Certificate", ex);
}
}
finally
{
if (!result.IsSuccess)
{
TaskManager.CompleteResultTask(result);
}
else
{
TaskManager.CompleteResultTask();
}
}
return result;
}
private static RdsCollection GetRdsCollectionInternal(int collectionId)
{
var collection = ObjectUtils.FillObjectFromDataReader<RdsCollection>(DataProvider.GetRDSCollectionById(collectionId));
@ -325,7 +429,7 @@ namespace WebsitePanel.EnterpriseServer
var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId));
var organizationUsers = OrganizationController.GetOrganizationUsersPaged(collection.ItemId, null, null, null, 0, Int32.MaxValue).PageUsers;
var organizationAdmins = rds.GetRdsCollectionLocalAdmins(servers.First().FqdName);
var organizationAdmins = rds.GetRdsCollectionLocalAdmins(org.OrganizationId, collection.Name);
return organizationUsers.Where(o => organizationAdmins.Select(a => a.ToLower()).Contains(o.DomainUserName.ToLower())).ToList();
}
@ -349,7 +453,7 @@ namespace WebsitePanel.EnterpriseServer
var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId));
var servers = ObjectUtils.CreateListFromDataReader<RdsServer>(DataProvider.GetRDSServersByCollectionId(collection.Id)).ToList();
rds.SaveRdsCollectionLocalAdmins(users, servers.Select(s => s.FqdName).ToArray());
rds.SaveRdsCollectionLocalAdmins(users.Select(u => u.AccountName).ToArray(), servers.Select(s => s.FqdName).ToArray(), org.OrganizationId, collection.Name);
}
catch (Exception ex)
{
@ -373,8 +477,24 @@ namespace WebsitePanel.EnterpriseServer
private static RdsCollectionSettings GetRdsCollectionSettingsInternal(int collectionId)
{
var collection = ObjectUtils.FillObjectFromDataReader<RdsCollection>(DataProvider.GetRDSCollectionById(collectionId));
var settings = ObjectUtils.FillObjectFromDataReader<RdsCollectionSettings>(DataProvider.GetRdsCollectionSettingsByCollectionId(collectionId));
return ObjectUtils.FillObjectFromDataReader<RdsCollectionSettings>(DataProvider.GetRdsCollectionSettingsByCollectionId(collectionId));
if (settings.SecurityLayer == null)
{
settings.SecurityLayer = SecurityLayerValues.Negotiate.ToString();
}
if (settings.EncryptionLevel == null)
{
settings.EncryptionLevel = EncryptionLevel.ClientCompatible.ToString();
}
if (settings.AuthenticateUsingNLA == null)
{
settings.AuthenticateUsingNLA = true;
}
return settings;
}
private static List<RdsCollection> GetOrganizationRdsCollectionsInternal(int itemId)
@ -426,7 +546,10 @@ namespace WebsitePanel.EnterpriseServer
ClientPrinterRedirected = true,
ClientPrinterAsDefault = true,
RDEasyPrintDriverEnabled = true,
MaxRedirectedMonitors = 16
MaxRedirectedMonitors = 16,
EncryptionLevel = EncryptionLevel.ClientCompatible.ToString(),
SecurityLayer = SecurityLayerValues.Negotiate.ToString(),
AuthenticateUsingNLA = true
};
rds.CreateCollection(org.OrganizationId, collection);
@ -599,8 +722,8 @@ namespace WebsitePanel.EnterpriseServer
}
var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId));
rds.RemoveCollection(org.OrganizationId, collection.Name);
var servers = ObjectUtils.CreateListFromDataReader<RdsServer>(DataProvider.GetRDSServersByCollectionId(collection.Id)).ToArray();
rds.RemoveCollection(org.OrganizationId, collection.Name, servers);
DataProvider.DeleteRDSCollection(collection.Id);
}
@ -696,8 +819,21 @@ namespace WebsitePanel.EnterpriseServer
}
var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(organization.PackageId));
var userSessions = rds.GetRdsUserSessions(collection.Name).ToList();
var organizationUsers = OrganizationController.GetOrganizationUsersPaged(collection.ItemId, null, null, null, 0, Int32.MaxValue).PageUsers;
return rds.GetRdsUserSessions(collection.Name).ToList();
foreach(var userSession in userSessions)
{
var organizationUser = organizationUsers.FirstOrDefault(o => o.SamAccountName.Equals(userSession.SamAccountName, StringComparison.CurrentCultureIgnoreCase));
if (organizationUser != null)
{
userSession.IsVip = organizationUser.IsVIP;
result.Add(userSession);
}
}
return result;
}
private static RdsServersPaged GetFreeRdsServersPagedInternal(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows)

View file

@ -325,5 +325,23 @@ namespace WebsitePanel.EnterpriseServer
{
return RemoteDesktopServicesController.SaveRdsCollectionLocalAdmins(users, collectionId);
}
[WebMethod]
public ResultObject InstallSessionHostsCertificate(RdsServer rdsServer)
{
return RemoteDesktopServicesController.InstallSessionHostsCertificate(rdsServer);
}
[WebMethod]
public RdsCertificate GetRdsCertificateByServiceId(int serviceId)
{
return RemoteDesktopServicesController.GetRdsCertificateByServiceId(serviceId);
}
[WebMethod]
public ResultObject AddRdsCertificate(RdsCertificate certificate)
{
return RemoteDesktopServicesController.AddRdsCertificate(certificate);
}
}
}

View file

@ -43,7 +43,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
bool CreateCollection(string organizationId, RdsCollection collection);
bool AddRdsServersToDeployment(RdsServer[] servers);
RdsCollection GetCollection(string collectionName);
bool RemoveCollection(string organizationId, string collectionName);
bool RemoveCollection(string organizationId, string collectionName, List<RdsServer> servers);
bool SetUsersInCollection(string organizationId, string collectionName, List<string> users);
void AddSessionHostServerToCollection(string organizationId, string collectionName, RdsServer server);
void AddSessionHostServersToCollection(string organizationId, string collectionName, List<RdsServer> servers);
@ -74,9 +74,10 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
string GetRdsServerStatus(string serverName);
void ShutDownRdsServer(string serverName);
void RestartRdsServer(string serverName);
void SaveRdsCollectionLocalAdmins(List<OrganizationUser> users, List<string> hosts);
List<string> GetRdsCollectionLocalAdmins(string hostName);
void SaveRdsCollectionLocalAdmins(List<string> users, List<string> hosts, string collectionName, string organizationId);
List<string> GetRdsCollectionLocalAdmins(string organizationId, string collectionName);
void MoveRdsServerToTenantOU(string hostName, string organizationId);
void RemoveRdsServerFromTenantOU(string hostName, string organizationId);
void InstallCertificate(byte[] certificate, string password, List<string> hostNames);
}
}

View file

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WebsitePanel.Providers.RemoteDesktopServices
{
public class RdsCertificate
{
public int Id { get; set; }
public int ServiceId { get; set; }
public string FileName { get; set; }
public string Content { get; set; }
public string Hash { get; set; }
public DateTime? ValidFrom { get; set; }
public DateTime? ExpiryDate { get; set; }
}
}

View file

@ -22,5 +22,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
public bool ClientPrinterAsDefault { get; set; }
public bool RDEasyPrintDriverEnabled { get; set; }
public int MaxRedirectedMonitors { get; set; }
public string SecurityLayer { get; set; }
public string EncryptionLevel { get; set; }
public bool AuthenticateUsingNLA { get; set; }
}
}

View file

@ -13,5 +13,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
public string SessionState { get; set; }
public string HostServer { get; set; }
public string DomainName { get; set; }
public bool IsVip { get; set; }
public string SamAccountName { get; set; }
}
}

View file

@ -36,5 +36,6 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
public string FileVirtualPath { get; set; }
public bool ShowInWebAccess { get; set; }
public string RequiredCommandLine { get; set; }
public string[] Users { get; set; }
}
}

View file

@ -129,6 +129,7 @@
<Compile Include="OS\QuotaType.cs" />
<Compile Include="OS\SystemFilesPaged.cs" />
<Compile Include="RemoteDesktopServices\IRemoteDesktopServices.cs" />
<Compile Include="RemoteDesktopServices\RdsCertificate.cs" />
<Compile Include="RemoteDesktopServices\RdsCollection.cs" />
<Compile Include="RemoteDesktopServices\RdsCollectionPaged.cs" />
<Compile Include="RemoteDesktopServices\RdsCollectionSettings.cs" />

View file

@ -64,14 +64,16 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
private const string Computers = "Computers";
private const string AdDcComputers = "Domain Controllers";
private const string Users = "users";
private const string Admins = "Admins";
private const string RdsGroupFormat = "rds-{0}-{1}";
private const string RdsModuleName = "RemoteDesktopServices";
private const string AddNpsString = "netsh nps add np name=\"\"{0}\"\" policysource=\"1\" processingorder=\"{1}\" conditionid=\"0x3d\" conditiondata=\"^5$\" conditionid=\"0x1fb5\" conditiondata=\"{2}\" conditionid=\"0x1e\" conditiondata=\"UserAuthType:(PW|CA)\" profileid=\"0x1005\" profiledata=\"TRUE\" profileid=\"0x100f\" profiledata=\"TRUE\" profileid=\"0x1009\" profiledata=\"0x7\" profileid=\"0x1fe6\" profiledata=\"0x40000000\"";
private const string WspAdministratorsGroupName = "WSP-Administrators";
private const string WspAdministratorsGroupDescription = "WSP Administrators";
private const string WspAdministratorsGroupName = "WSP-Org-Administrators";
private const string WspAdministratorsGroupDescription = "WSP Org Administrators";
private const string RdsServersOU = "RDSServers";
private const uint ADS_GROUP_TYPE_UNIVERSAL_GROUP = 0x00000008;
private const uint ADS_GROUP_TYPE_SECURITY_ENABLED = 0x80000000;
private const string RDSHelpDeskComputerGroup = "Websitepanel-RDSHelpDesk-Computer";
private const string RDSHelpDeskGroup = "WSP-HelpDeskAdministrators";
private const string RDSHelpDeskGroupDescription = "WSP Help Desk Administrators";
#endregion
@ -309,6 +311,9 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
//ActiveDirectoryUtils.AddObjectToGroup(GetComputerPath(ConnectionBroker), GetComputerGroupPath(organizationId, collection.Name));
}
CheckOrCreateHelpDeskComputerGroup();
string helpDeskGroupSamAccountName = CheckOrCreateAdGroup(GetHelpDeskGroupPath(RDSHelpDeskGroup), GetRootOUPath(), RDSHelpDeskGroup, RDSHelpDeskGroupDescription);
if (!ActiveDirectoryUtils.AdObjectExists(GetUsersGroupPath(organizationId, collection.Name)))
{
//Create user group
@ -339,6 +344,12 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
//add session servers to group
foreach (var rdsServer in collection.Servers)
{
if (!CheckLocalAdminsGroupExists(rdsServer.FqdName, runSpace))
{
CreateLocalAdministratorsGroup(rdsServer.FqdName, runSpace);
}
AddAdGroupToLocalAdmins(runSpace, rdsServer.FqdName, helpDeskGroupSamAccountName);
AddComputerToCollectionAdComputerGroup(organizationId, collection.Name, rdsServer);
}
}
@ -467,7 +478,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
return collection;
}
public bool RemoveCollection(string organizationId, string collectionName)
public bool RemoveCollection(string organizationId, string collectionName, List<RdsServer> servers)
{
var result = true;
@ -502,10 +513,15 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
RemoveNpsPolicy(runSpace, CentralNpsHost, capPolicyName);
}
//Remove security group
foreach(var server in servers)
{
RemoveGroupFromLocalAdmin(server.FqdName, server.Name, GetLocalAdminsGroupName(collectionName), runSpace);
RemoveComputerFromCollectionAdComputerGroup(organizationId, collectionName, server);
}
ActiveDirectoryUtils.DeleteADObject(GetComputerGroupPath(organizationId, collectionName));
ActiveDirectoryUtils.DeleteADObject(GetUsersGroupPath(organizationId, collectionName));
ActiveDirectoryUtils.DeleteADObject(GetGroupPath(organizationId, collectionName, GetLocalAdminsGroupName(collectionName)));
}
catch (Exception e)
{
@ -519,18 +535,15 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
return result;
}
public List<string> GetCollectionUsers(string collectionName)
{
return GetUsersToCollectionAdGroup(collectionName);
}
public bool SetUsersInCollection(string organizationId, string collectionName, List<string> users)
{
var result = true;
try
{
SetUsersToCollectionAdGroup(collectionName, organizationId, users);
var usersGroupName = GetUsersGroupName(collectionName);
var usersGroupPath = GetUsersGroupPath(organizationId, collectionName);
SetUsersToCollectionAdGroup(collectionName, organizationId, users, usersGroupName, usersGroupPath);
}
catch (Exception e)
{
@ -561,6 +574,15 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
ExecuteShellCommand(runSpace, cmd, false);
CheckOrCreateHelpDeskComputerGroup();
string helpDeskGroupSamAccountName = CheckOrCreateAdGroup(GetHelpDeskGroupPath(RDSHelpDeskGroup), GetRootOUPath(), RDSHelpDeskGroup, RDSHelpDeskGroupDescription);
if (!CheckLocalAdminsGroupExists(server.FqdName, runSpace))
{
CreateLocalAdministratorsGroup(server.FqdName, runSpace);
}
AddAdGroupToLocalAdmins(runSpace, server.FqdName, helpDeskGroupSamAccountName);
AddComputerToCollectionAdComputerGroup(organizationId, collectionName, server);
}
catch (Exception e)
@ -596,6 +618,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
ExecuteShellCommand(runSpace, cmd, false);
RemoveGroupFromLocalAdmin(server.FqdName, server.Name, GetLocalAdminsGroupName(collectionName), runSpace);
RemoveComputerFromCollectionAdComputerGroup(organizationId, collectionName, server);
}
finally
@ -958,7 +981,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
#region Local Admins
public void SaveRdsCollectionLocalAdmins(List<OrganizationUser> users, List<string> hosts)
public void SaveRdsCollectionLocalAdmins(List<string> users, List<string> hosts, string collectionName, string organizationId)
{
Runspace runspace = null;
@ -967,6 +990,10 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
runspace = OpenRunspace();
var index = ServerSettings.ADRootDomain.LastIndexOf(".");
var domainName = ServerSettings.ADRootDomain;
string groupName = GetLocalAdminsGroupName(collectionName);
string groupPath = GetGroupPath(organizationId, collectionName, groupName);
string helpDeskGroupSamAccountName = CheckOrCreateAdGroup(GetHelpDeskGroupPath(RDSHelpDeskGroup), GetRootOUPath(), RDSHelpDeskGroup, RDSHelpDeskGroupDescription);
string localAdminsGroupSamAccountName = CheckOrCreateAdGroup(groupPath, GetOrganizationPath(organizationId), groupName, WspAdministratorsGroupDescription);
if (index > 0)
{
@ -986,20 +1013,10 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
}
}
var existingAdmins = GetExistingLocalAdmins(hostName, runspace).Select(e => e.ToLower());
var formUsers = users.Select(u => string.Format("{0}\\{1}", domainName, u.SamAccountName).ToLower());
var newUsers = users.Where(u => !existingAdmins.Contains(string.Format("{0}\\{1}", domainName, u.SamAccountName).ToLower()));
var removedUsers = existingAdmins.Where(e => !formUsers.Contains(e));
AddAdGroupToLocalAdmins(runspace, hostName, helpDeskGroupSamAccountName);
AddAdGroupToLocalAdmins(runspace, hostName, localAdminsGroupSamAccountName);
foreach (var user in newUsers)
{
AddNewLocalAdmin(hostName, user.SamAccountName, runspace);
}
foreach (var user in removedUsers)
{
RemoveLocalAdmin(hostName, user, runspace);
}
SetUsersToCollectionAdGroup(collectionName, organizationId, users, GetLocalAdminsGroupName(collectionName), groupPath);
}
}
finally
@ -1008,26 +1025,10 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
}
}
public List<string> GetRdsCollectionLocalAdmins(string hostName)
public List<string> GetRdsCollectionLocalAdmins(string organizationId, string collectionName)
{
Runspace runspace = null;
var result = new List<string>();
try
{
runspace = OpenRunspace();
if (CheckLocalAdminsGroupExists(hostName, runspace))
{
result = GetExistingLocalAdmins(hostName, runspace);
}
}
finally
{
CloseRunspace(runspace);
}
return result;
string groupName = GetLocalAdminsGroupName(collectionName);
return GetUsersToCollectionAdGroup(collectionName, groupName, organizationId);
}
private bool CheckLocalAdminsGroupExists(string hostName, Runspace runspace)
@ -1077,30 +1078,74 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
return errors;
}
private List<string> GetExistingLocalAdmins(string hostName, Runspace runspace)
private void RemoveGroupFromLocalAdmin(string fqdnName, string hostName, string groupName, Runspace runspace)
{
var result = new List<string>();
var scripts = new List<string>
{
string.Format("net localgroup {0} | select -skip 6", WspAdministratorsGroupName)
string.Format("$GroupObj = [ADSI]\"WinNT://{0}/{1}\"", hostName, WspAdministratorsGroupName),
string.Format("$GroupObj.Remove(\"WinNT://{0}/{1}\")", ServerSettings.ADRootDomain, RDSHelpDeskGroup),
string.Format("$GroupObj.Remove(\"WinNT://{0}/{1}\")", ServerSettings.ADRootDomain, groupName)
};
object[] errors = null;
var exitingAdmins = ExecuteRemoteShellCommand(runspace, hostName, scripts, out errors);
ExecuteRemoteShellCommand(runspace, fqdnName, scripts, out errors);
}
if (!errors.Any())
#endregion
#region RDS Help Desk
private string GetHelpDeskGroupPath(string groupName)
{
foreach(var user in exitingAdmins.Take(exitingAdmins.Count - 2))
StringBuilder sb = new StringBuilder();
AppendProtocol(sb);
AppendDomainController(sb);
AppendCNPath(sb, groupName);
AppendOUPath(sb, RootOU);
AppendDomainPath(sb, RootDomain);
return sb.ToString();
}
private void CheckOrCreateHelpDeskComputerGroup()
{
result.Add(user.ToString());
if (!ActiveDirectoryUtils.AdObjectExists(GetHelpDeskGroupPath(RDSHelpDeskComputerGroup)))
{
ActiveDirectoryUtils.CreateGroup(GetRootOUPath(), RDSHelpDeskComputerGroup);
}
}
return result;
private string CheckOrCreateAdGroup(string groupPath, string rootPath, string groupName, string description)
{
DirectoryEntry groupEntry = null;
if (!ActiveDirectoryUtils.AdObjectExists(groupPath))
{
ActiveDirectoryUtils.CreateGroup(rootPath, groupName);
groupEntry = ActiveDirectoryUtils.GetADObject(groupPath);
if (groupEntry.Properties.Contains("Description"))
{
groupEntry.Properties["Description"][0] = description;
}
else
{
groupEntry.Properties["Description"].Add(description);
}
private object[] AddNewLocalAdmin(string hostName, string samAccountName, Runspace runspace)
groupEntry.CommitChanges();
}
if (groupEntry == null)
{
groupEntry = ActiveDirectoryUtils.GetADObject(groupPath);
}
return ActiveDirectoryUtils.GetADObjectProperty(groupEntry, "sAMAccountName").ToString();
}
private void AddAdGroupToLocalAdmins(Runspace runspace, string hostName, string samAccountName)
{
var scripts = new List<string>
{
@ -1110,18 +1155,63 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
object[] errors = null;
ExecuteRemoteShellCommand(runspace, hostName, scripts, out errors);
return errors;
}
private object[] RemoveLocalAdmin(string hostName, string user, Runspace runspace)
{
var userObject = user.Split('\\');
#endregion
#region SSL
public void InstallCertificate(byte[] certificate, string password, List<string> hostNames)
{
Runspace runspace = null;
try
{
var guid = Guid.NewGuid();
var x509Cert = new X509Certificate2(certificate, password, X509KeyStorageFlags.Exportable);
//var content = x509Cert.Export(X509ContentType.Pfx);
var filePath = SaveCertificate(certificate, guid);
runspace = OpenRunspace();
foreach (var hostName in hostNames)
{
var destinationPath = string.Format("\\\\{0}\\c$\\{1}.pfx", hostName, guid);
var errors = CopyCertificateFile(runspace, filePath, destinationPath);
if (!errors.Any())
{
errors = ImportCertificate(runspace, hostName, password, string.Format("c:\\{0}.pfx", guid), x509Cert.Thumbprint);
}
DeleteCertificateFile(destinationPath, runspace);
if (errors.Any())
{
Log.WriteWarning(string.Join("\r\n", errors.Select(e => e.ToString()).ToArray()));
throw new Exception(string.Join("\r\n", errors.Select(e => e.ToString()).ToArray()));
}
}
if (File.Exists(filePath))
{
File.Delete(filePath);
}
}
finally
{
CloseRunspace(runspace);
}
}
private object[] ImportCertificate(Runspace runspace, string hostName, string password, string certificatePath, string thumbprint)
{
var scripts = new List<string>
{
string.Format("$GroupObj = [ADSI]\"WinNT://{0}/{1}\"", hostName, WspAdministratorsGroupName),
string.Format("$GroupObj.Remove(\"WinNT://{0}/{1}\")", userObject[0], userObject[1])
string.Format("$mypwd = ConvertTo-SecureString -String {0} -Force AsPlainText", password),
string.Format("Import-PfxCertificate FilePath \"{0}\" cert:\\localMachine\\my -Password $mypwd", certificatePath),
string.Format("$cert = Get-Item cert:\\LocalMachine\\My\\{0}", thumbprint),
string.Format("$path = (Get-WmiObject -class \"Win32_TSGeneralSetting\" -Namespace root\\cimv2\\terminalservices -Filter \"TerminalName='RDP-tcp'\").__path"),
string.Format("Set-WmiInstance -Path $path -argument @{0}", string.Format("{{SSLCertificateSHA1Hash=\"{0}\"}}", thumbprint))
};
object[] errors = null;
@ -1130,36 +1220,44 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
return errors;
}
#endregion
#region SSL
public void InstallCertificate(byte[] certificate, string password, string hostName)
private string SaveCertificate(byte[] certificate, Guid guid)
{
Runspace runspace = null;
var filePath = string.Format("{0}{1}.pfx", Path.GetTempPath(), guid);
try
if (File.Exists(filePath))
{
var x509Cert = new X509Certificate2(certificate, password, X509KeyStorageFlags.Exportable);
runspace = OpenRunspace();
CopyCertificateFile(certificate, hostName, runspace);
}
finally
{
CloseRunspace(runspace);
}
File.Delete(filePath);
}
private string CopyCertificateFile(byte[] certificate, string hostName, Runspace runspace)
{
var destinationPath = string.Format("\\{0}\\c$\\remoteCert.pfx", hostName);
File.WriteAllBytes(filePath, certificate);
return destinationPath;
return filePath;
}
private void DeleteCertificate(string path, Runspace runspace)
private object[] CopyCertificateFile(Runspace runspace, string filePath, string destinationPath)
{
var scripts = new List<string>
{
string.Format("Copy-Item \"{0}\" -Destination \"{1}\" -Force", filePath, destinationPath)
};
object[] errors = null;
ExecuteShellCommand(runspace, scripts, out errors);
return errors;
}
private object[] DeleteCertificateFile(string destinationPath, Runspace runspace)
{
var scripts = new List<string>
{
string.Format("Remove-Item -Path \"{0}\" -Force", destinationPath)
};
object[] errors = null;
ExecuteShellCommand(runspace, scripts, out errors);
return errors;
}
#endregion
@ -1198,21 +1296,17 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
return false;
}
private void SetUsersToCollectionAdGroup(string collectionName, string organizationId, IEnumerable<string> users)
private void SetUsersToCollectionAdGroup(string collectionName, string organizationId, IEnumerable<string> users, string groupName, string groupPath)
{
var usersGroupName = GetUsersGroupName(collectionName);
var usersGroupPath = GetUsersGroupPath(organizationId, collectionName);
var orgPath = GetOrganizationPath(organizationId);
var orgEntry = ActiveDirectoryUtils.GetADObject(orgPath);
var groupUsers = ActiveDirectoryUtils.GetGroupObjects(usersGroupName, "user", orgEntry);
var groupUsers = ActiveDirectoryUtils.GetGroupObjects(groupName, "user", orgEntry);
//remove all users from group
foreach (string userPath in groupUsers)
{
ActiveDirectoryUtils.RemoveObjectFromGroup(userPath, usersGroupPath);
ActiveDirectoryUtils.RemoveObjectFromGroup(userPath, groupPath);
}
//adding users to group
foreach (var user in users)
{
var userPath = GetUserPath(organizationId, user);
@ -1221,19 +1315,18 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
{
var userObject = ActiveDirectoryUtils.GetADObject(userPath);
var samName = (string)ActiveDirectoryUtils.GetADObjectProperty(userObject, "sAMAccountName");
var userGroupsPath = GetUsersGroupPath(organizationId, collectionName);
ActiveDirectoryUtils.AddObjectToGroup(userPath, userGroupsPath);
ActiveDirectoryUtils.AddObjectToGroup(userPath, groupPath);
}
}
}
private List<string> GetUsersToCollectionAdGroup(string collectionName)
private List<string> GetUsersToCollectionAdGroup(string collectionName, string groupName, string organizationId)
{
var users = new List<string>();
var orgPath = GetOrganizationPath(organizationId);
var orgEntry = ActiveDirectoryUtils.GetADObject(orgPath);
var usersGroupName = GetUsersGroupName(collectionName);
foreach (string userPath in ActiveDirectoryUtils.GetGroupObjects(usersGroupName, "user"))
foreach (string userPath in ActiveDirectoryUtils.GetGroupObjects(groupName, "user", orgEntry))
{
var userObject = ActiveDirectoryUtils.GetADObject(userPath);
var samName = (string)ActiveDirectoryUtils.GetADObjectProperty(userObject, "sAMAccountName");
@ -1273,6 +1366,11 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
{
ActiveDirectoryUtils.AddObjectToGroup(computerPath, GetComputerGroupPath(organizationId, collectionName));
}
if (!ActiveDirectoryUtils.IsComputerInGroup(samName, RDSHelpDeskComputerGroup))
{
ActiveDirectoryUtils.AddObjectToGroup(computerPath, GetHelpDeskGroupPath(RDSHelpDeskComputerGroup));
}
}
SetRDServerNewConnectionAllowed(false, server);
@ -1297,6 +1395,14 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
{
ActiveDirectoryUtils.RemoveObjectFromGroup(computerPath, GetComputerGroupPath(organizationId, collectionName));
}
if (ActiveDirectoryUtils.AdObjectExists(GetHelpDeskGroupPath(RDSHelpDeskComputerGroup)))
{
if (ActiveDirectoryUtils.IsComputerInGroup(samName, RDSHelpDeskComputerGroup))
{
ActiveDirectoryUtils.RemoveObjectFromGroup(computerPath, GetHelpDeskGroupPath(RDSHelpDeskComputerGroup));
}
}
}
}
@ -1487,11 +1593,18 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
DisplayName = Convert.ToString(GetPSObjectProperty(psObject, "DisplayName")),
FilePath = Convert.ToString(GetPSObjectProperty(psObject, "FilePath")),
Alias = Convert.ToString(GetPSObjectProperty(psObject, "Alias")),
ShowInWebAccess = Convert.ToBoolean(GetPSObjectProperty(psObject, "ShowInWebAccess"))
ShowInWebAccess = Convert.ToBoolean(GetPSObjectProperty(psObject, "ShowInWebAccess")),
Users = null
};
var requiredCommandLine = GetPSObjectProperty(psObject, "RequiredCommandLine");
remoteApp.RequiredCommandLine = requiredCommandLine == null ? null : requiredCommandLine.ToString();
var users = (string[])(GetPSObjectProperty(psObject, "UserGroups"));
if (users != null && users.Any())
{
remoteApp.Users = users;
}
return remoteApp;
}
@ -1561,10 +1674,15 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
return string.Format(RdsGroupFormat, collectionName, Users.ToLowerInvariant());
}
private string GetLocalAdminsGroupName(string collectionName)
{
return string.Format(RdsGroupFormat, collectionName, Admins.ToLowerInvariant());
}
internal string GetComputerGroupPath(string organizationId, string collection)
{
StringBuilder sb = new StringBuilder();
// append provider
AppendProtocol(sb);
AppendDomainController(sb);
AppendCNPath(sb, GetComputersGroupName(collection));
@ -1578,7 +1696,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
internal string GetUsersGroupPath(string organizationId, string collection)
{
StringBuilder sb = new StringBuilder();
// append provider
AppendProtocol(sb);
AppendDomainController(sb);
AppendCNPath(sb, GetUsersGroupName(collection));
@ -1589,6 +1707,20 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
return sb.ToString();
}
private string GetGroupPath(string organizationId, string collectionName, string groupName)
{
StringBuilder sb = new StringBuilder();
AppendProtocol(sb);
AppendDomainController(sb);
AppendCNPath(sb, groupName);
AppendOUPath(sb, organizationId);
AppendOUPath(sb, RootOU);
AppendDomainPath(sb, RootDomain);
return sb.ToString();
}
private string GetUserPath(string organizationId, string loginName)
{
StringBuilder sb = new StringBuilder();
@ -2117,14 +2249,18 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
foreach(var userSession in userSessions)
{
var session = new RdsUserSession();
foreach(var prop in properties)
var session = new RdsUserSession
{
prop.SetValue(session, GetPSObjectProperty(userSession, prop.Name).ToString(), null);
}
CollectionName = GetPSObjectProperty(userSession, "CollectionName").ToString(),
DomainName = GetPSObjectProperty(userSession, "DomainName").ToString(),
HostServer = GetPSObjectProperty(userSession, "HostServer").ToString(),
SessionState = GetPSObjectProperty(userSession, "SessionState").ToString(),
UnifiedSessionId = GetPSObjectProperty(userSession, "UnifiedSessionId").ToString(),
SamAccountName = GetPSObjectProperty(userSession, "UserName").ToString(),
};
session.UserName = GetUserFullName(session.DomainName, session.UserName, runSpace);
session.IsVip = false;
session.UserName = GetUserFullName(session.DomainName, session.SamAccountName, runSpace);
result.Add(session);
}

View file

@ -18,7 +18,6 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
using System.Web.Services.Protocols;
using System;
using System.Diagnostics;
using WebsitePanel.Providers.HostedSolution;
/// <remarks/>
@ -98,6 +97,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
private System.Threading.SendOrPostCallback RemoveRdsServerFromTenantOUOperationCompleted;
private System.Threading.SendOrPostCallback InstallCertificateOperationCompleted;
/// <remarks/>
public RemoteDesktopServices() {
this.Url = "http://localhost:9003/RemoteDesktopServices.asmx";
@ -205,6 +206,9 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
/// <remarks/>
public event RemoveRdsServerFromTenantOUCompletedEventHandler RemoveRdsServerFromTenantOUCompleted;
/// <remarks/>
public event InstallCertificateCompletedEventHandler InstallCertificateCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/CreateCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
@ -419,18 +423,20 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/RemoveCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public bool RemoveCollection(string organizationId, string collectionName) {
public bool RemoveCollection(string organizationId, string collectionName, RdsServer[] servers) {
object[] results = this.Invoke("RemoveCollection", new object[] {
organizationId,
collectionName});
collectionName,
servers});
return ((bool)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginRemoveCollection(string organizationId, string collectionName, System.AsyncCallback callback, object asyncState) {
public System.IAsyncResult BeginRemoveCollection(string organizationId, string collectionName, RdsServer[] servers, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("RemoveCollection", new object[] {
organizationId,
collectionName}, callback, asyncState);
collectionName,
servers}, callback, asyncState);
}
/// <remarks/>
@ -440,18 +446,19 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
}
/// <remarks/>
public void RemoveCollectionAsync(string organizationId, string collectionName) {
this.RemoveCollectionAsync(organizationId, collectionName, null);
public void RemoveCollectionAsync(string organizationId, string collectionName, RdsServer[] servers) {
this.RemoveCollectionAsync(organizationId, collectionName, servers, null);
}
/// <remarks/>
public void RemoveCollectionAsync(string organizationId, string collectionName, object userState) {
public void RemoveCollectionAsync(string organizationId, string collectionName, RdsServer[] servers, object userState) {
if ((this.RemoveCollectionOperationCompleted == null)) {
this.RemoveCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRemoveCollectionOperationCompleted);
}
this.InvokeAsync("RemoveCollection", new object[] {
organizationId,
collectionName}, this.RemoveCollectionOperationCompleted, userState);
collectionName,
servers}, this.RemoveCollectionOperationCompleted, userState);
}
private void OnRemoveCollectionOperationCompleted(object arg) {
@ -1507,17 +1514,21 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/SaveRdsCollectionLocalAdmins", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void SaveRdsCollectionLocalAdmins(OrganizationUser[] users, string[] hosts) {
public void SaveRdsCollectionLocalAdmins(string[] users, string[] hosts, string organizationId, string collectionName) {
this.Invoke("SaveRdsCollectionLocalAdmins", new object[] {
users,
hosts});
hosts,
organizationId,
collectionName});
}
/// <remarks/>
public System.IAsyncResult BeginSaveRdsCollectionLocalAdmins(OrganizationUser[] users, string[] hosts, System.AsyncCallback callback, object asyncState) {
public System.IAsyncResult BeginSaveRdsCollectionLocalAdmins(string[] users, string[] hosts, string organizationId, string collectionName, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("SaveRdsCollectionLocalAdmins", new object[] {
users,
hosts}, callback, asyncState);
hosts,
organizationId,
collectionName}, callback, asyncState);
}
/// <remarks/>
@ -1526,18 +1537,20 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
}
/// <remarks/>
public void SaveRdsCollectionLocalAdminsAsync(OrganizationUser[] users, string[] hosts) {
this.SaveRdsCollectionLocalAdminsAsync(users, hosts, null);
public void SaveRdsCollectionLocalAdminsAsync(string[] users, string[] hosts, string organizationId, string collectionName) {
this.SaveRdsCollectionLocalAdminsAsync(users, hosts, organizationId, collectionName, null);
}
/// <remarks/>
public void SaveRdsCollectionLocalAdminsAsync(OrganizationUser[] users, string[] hosts, object userState) {
public void SaveRdsCollectionLocalAdminsAsync(string[] users, string[] hosts, string organizationId, string collectionName, object userState) {
if ((this.SaveRdsCollectionLocalAdminsOperationCompleted == null)) {
this.SaveRdsCollectionLocalAdminsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSaveRdsCollectionLocalAdminsOperationCompleted);
}
this.InvokeAsync("SaveRdsCollectionLocalAdmins", new object[] {
users,
hosts}, this.SaveRdsCollectionLocalAdminsOperationCompleted, userState);
hosts,
organizationId,
collectionName}, this.SaveRdsCollectionLocalAdminsOperationCompleted, userState);
}
private void OnSaveRdsCollectionLocalAdminsOperationCompleted(object arg) {
@ -1550,16 +1563,18 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetRdsCollectionLocalAdmins", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public string[] GetRdsCollectionLocalAdmins(string hostName) {
public string[] GetRdsCollectionLocalAdmins(string organizationId, string collectionName) {
object[] results = this.Invoke("GetRdsCollectionLocalAdmins", new object[] {
hostName});
organizationId,
collectionName});
return ((string[])(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetRdsCollectionLocalAdmins(string hostName, System.AsyncCallback callback, object asyncState) {
public System.IAsyncResult BeginGetRdsCollectionLocalAdmins(string organizationId, string collectionName, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetRdsCollectionLocalAdmins", new object[] {
hostName}, callback, asyncState);
organizationId,
collectionName}, callback, asyncState);
}
/// <remarks/>
@ -1569,17 +1584,18 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
}
/// <remarks/>
public void GetRdsCollectionLocalAdminsAsync(string hostName) {
this.GetRdsCollectionLocalAdminsAsync(hostName, null);
public void GetRdsCollectionLocalAdminsAsync(string organizationId, string collectionName) {
this.GetRdsCollectionLocalAdminsAsync(organizationId, collectionName, null);
}
/// <remarks/>
public void GetRdsCollectionLocalAdminsAsync(string hostName, object userState) {
public void GetRdsCollectionLocalAdminsAsync(string organizationId, string collectionName, object userState) {
if ((this.GetRdsCollectionLocalAdminsOperationCompleted == null)) {
this.GetRdsCollectionLocalAdminsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRdsCollectionLocalAdminsOperationCompleted);
}
this.InvokeAsync("GetRdsCollectionLocalAdmins", new object[] {
hostName}, this.GetRdsCollectionLocalAdminsOperationCompleted, userState);
organizationId,
collectionName}, this.GetRdsCollectionLocalAdminsOperationCompleted, userState);
}
private void OnGetRdsCollectionLocalAdminsOperationCompleted(object arg) {
@ -1675,6 +1691,52 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/InstallCertificate", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void InstallCertificate([System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")] byte[] certificate, string password, string[] hostNames) {
this.Invoke("InstallCertificate", new object[] {
certificate,
password,
hostNames});
}
/// <remarks/>
public System.IAsyncResult BeginInstallCertificate(byte[] certificate, string password, string[] hostNames, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("InstallCertificate", new object[] {
certificate,
password,
hostNames}, callback, asyncState);
}
/// <remarks/>
public void EndInstallCertificate(System.IAsyncResult asyncResult) {
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void InstallCertificateAsync(byte[] certificate, string password, string[] hostNames) {
this.InstallCertificateAsync(certificate, password, hostNames, null);
}
/// <remarks/>
public void InstallCertificateAsync(byte[] certificate, string password, string[] hostNames, object userState) {
if ((this.InstallCertificateOperationCompleted == null)) {
this.InstallCertificateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnInstallCertificateOperationCompleted);
}
this.InvokeAsync("InstallCertificate", new object[] {
certificate,
password,
hostNames}, this.InstallCertificateOperationCompleted, userState);
}
private void OnInstallCertificateOperationCompleted(object arg) {
if ((this.InstallCertificateCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.InstallCertificateCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
@ -2300,4 +2362,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void RemoveRdsServerFromTenantOUCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void InstallCertificateCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
}

View file

@ -146,12 +146,12 @@ namespace WebsitePanel.Server
}
[WebMethod, SoapHeader("settings")]
public bool RemoveCollection(string organizationId, string collectionName)
public bool RemoveCollection(string organizationId, string collectionName, List<RdsServer> servers)
{
try
{
Log.WriteStart("'{0}' RemoveCollection", ProviderSettings.ProviderName);
var result = RDSProvider.RemoveCollection(organizationId, collectionName);
var result = RDSProvider.RemoveCollection(organizationId, collectionName, servers);
Log.WriteEnd("'{0}' RemoveCollection", ProviderSettings.ProviderName);
return result;
}
@ -566,12 +566,12 @@ namespace WebsitePanel.Server
}
[WebMethod, SoapHeader("settings")]
public void SaveRdsCollectionLocalAdmins(List<OrganizationUser> users, List<string> hosts)
public void SaveRdsCollectionLocalAdmins(List<string> users, List<string> hosts, string organizationId, string collectionName)
{
try
{
Log.WriteStart("'{0}' SaveRdsCollectionLocalAdmins", ProviderSettings.ProviderName);
RDSProvider.SaveRdsCollectionLocalAdmins(users, hosts);
RDSProvider.SaveRdsCollectionLocalAdmins(users, hosts, collectionName, organizationId);
Log.WriteEnd("'{0}' SaveRdsCollectionLocalAdmins", ProviderSettings.ProviderName);
}
catch (Exception ex)
@ -582,12 +582,12 @@ namespace WebsitePanel.Server
}
[WebMethod, SoapHeader("settings")]
public List<string> GetRdsCollectionLocalAdmins(string hostName)
public List<string> GetRdsCollectionLocalAdmins(string organizationId, string collectionName)
{
try
{
Log.WriteStart("'{0}' GetRdsCollectionLocalAdmins", ProviderSettings.ProviderName);
var result = RDSProvider.GetRdsCollectionLocalAdmins(hostName);
var result = RDSProvider.GetRdsCollectionLocalAdmins(organizationId, collectionName);
Log.WriteEnd("'{0}' GetRdsCollectionLocalAdmins", ProviderSettings.ProviderName);
return result;
@ -630,5 +630,21 @@ namespace WebsitePanel.Server
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void InstallCertificate(byte[] certificate, string password, List<string> hostNames)
{
try
{
Log.WriteStart("'{0}' InstallCertificate", ProviderSettings.ProviderName);
RDSProvider.InstallCertificate(certificate, password, hostNames);
Log.WriteEnd("'{0}' InstallCertificate", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' InstallCertificate", ProviderSettings.ProviderName), ex);
throw;
}
}
}
}

View file

@ -5,17 +5,6 @@
<section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3"/>
<section name="websitepanel.server" type="WebsitePanel.Server.ServerConfiguration, WebsitePanel.Server"/>
<section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings,Microsoft.Practices.EnterpriseLibrary.Caching"/>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>
</sectionGroup>
</configSections>
<appSettings>
<add key="WebsitePanel.HyperV.UseDiskPartClearReadOnlyFlag" value="false"/>

View file

@ -5653,6 +5653,12 @@
<data name="ERROR.RDSCOLLECTION_NOT_CREATED" xml:space="preserve">
<value>Collection not created</value>
</data>
<data name="ERROR.RDSSESSIONHOST_CERTIFICATE_NOT_INSTALLED" xml:space="preserve">
<value>Session host certificate not installed</value>
</data>
<data name="Success.RDSSESSIONHOST_CERTIFICATE_INSTALLED" xml:space="preserve">
<value>Session host certificate has been installed</value>
</data>
<data name="ERROR.RDSCOLLECTIONSETTINGS_NOT_UPDATES" xml:space="preserve">
<value>RDS Collection settings not updated</value>
</data>

View file

@ -120,6 +120,9 @@
<data name="btnAddRDSServer.Text" xml:space="preserve">
<value>Add RDS Server</value>
</data>
<data name="gvPopupStatus.HeaderText" xml:space="preserve">
<value>Status</value>
</data>
<data name="gvRDSServers.Empty" xml:space="preserve">
<value>The list of RDS Servers is empty.&lt;br&gt;&lt;br&gt;To add a new Server click "Add RDS Sever" button.</value>
</data>

View file

@ -52,11 +52,15 @@ namespace WebsitePanel.Portal
{
rdsServers = ES.Services.RDS.GetRdsServersPaged("", filterValue, sortColumn, startRowIndex, maximumRows);
foreach (var rdsServer in rdsServers.Servers)
{
if (rdsServer.ItemId.HasValue)
{
rdsServer.Status = ES.Services.RDS.GetRdsServerStatus(rdsServer.ItemId.Value, rdsServer.FqdName);
}
}
return rdsServers.Servers;
//return new RdsServer[] { new RdsServer { Name = "rds.1.server", FqdName = "", Address = "127.0.0.1" },
// new RdsServer { Name = "rds.2.server", FqdName = "", Address = "127.0.0.2" },
// new RdsServer { Name = "rds.3.server", FqdName = "", Address = "127.0.0.3" },
// new RdsServer { Name = "rds.4.server", FqdName = "", Address = "127.0.0.4" }};
}
public int GetOrganizationRdsServersPagedCount(int itemId, string filterValue)

View file

@ -126,4 +126,7 @@
<data name="ServerNameColumn.HeaderText" xml:space="preserve">
<value>Server Name</value>
</data>
<data name="lblPFXInstallPassword.Text" xml:space="preserve">
<value>Certificate Password:</value>
</data>
</root>

View file

@ -1,5 +1,17 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDS_Settings.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.RDS_Settings" %>
<table>
<tr>
<td colspan ="2" style="padding: 10px 0 10px 0;"><asp:FileUpload ID="upPFX" runat="server"/></td>
</tr>
<tr><td></td></tr>
<tr>
<td class="SubHead" style="width:200px" nowrap>
<asp:Localize runat="server" meta:resourcekey="lblPFXInstallPassword" />
</td>
<td>
<asp:TextBox ID="txtPFXInstallPassword" runat="server" TextMode="Password" Width="200px" />
</td>
</tr>
<tr>
<td class="SubHead" width="200" nowrap>
<asp:Label runat="server" ID="lblConnectionBroker" meta:resourcekey="lblConnectionBroker" Text="Connection Broker:"/>

View file

@ -31,6 +31,7 @@ using System.Collections.Generic;
using System.Web.UI.WebControls;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.RemoteDesktopServices;
namespace WebsitePanel.Portal.ProviderControls
{
@ -58,7 +59,6 @@ namespace WebsitePanel.Portal.ProviderControls
txtConnectionBroker.Text = settings["ConnectionBroker"];
GWServers = settings["GWServrsList"];
UpdateLyncServersGrid();
txtRootOU.Text = settings["RootOU"];
@ -87,6 +87,25 @@ namespace WebsitePanel.Portal.ProviderControls
settings["CentralNPS"] = chkUseCentralNPS.Checked ? txtCentralNPS.Text : string.Empty;
settings["GWServrsList"] = GWServers;
try
{
if (upPFX.HasFile.Equals(true))
{
var certificate = new RdsCertificate
{
ServiceId = PanelRequest.ServiceId,
Content = Convert.ToBase64String(upPFX.FileBytes),
FileName = upPFX.FileName,
Hash = txtPFXInstallPassword.Text
};
ES.Services.RDS.AddRdsCertificate(certificate);
}
}
catch (Exception)
{
}
}
protected void chkUseCentralNPS_CheckedChanged(object sender, EventArgs e)

View file

@ -1,31 +1,3 @@
// Copyright (c) 2015, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@ -40,6 +12,24 @@ namespace WebsitePanel.Portal.ProviderControls {
public partial class RDS_Settings {
/// <summary>
/// upPFX control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.FileUpload upPFX;
/// <summary>
/// txtPFXInstallPassword control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtPFXInstallPassword;
/// <summary>
/// lblConnectionBroker control.
/// </summary>

View file

@ -1 +0,0 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SmarterMail100_EditForwarding .ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.SmarterMail100_EditForwarding" %>

View file

@ -0,0 +1 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SmarterMail100_EditForwarding.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.SmarterMail100_EditForwarding" %>

View file

@ -145,7 +145,7 @@
<value>Assigned RDS Servers</value>
</data>
<data name="locQuota.Text" xml:space="preserve">
<value>Total RDS Servers Allocated:</value>
<value>Total Remote Desktop Servers Allocated:</value>
</data>
<data name="cmdDisable.Text" xml:space="preserve">
<value>Disable</value>

View file

@ -147,4 +147,7 @@
<data name="gvServer.Header" xml:space="preserve">
<value>RDS Server</value>
</data>
<data name="locQuota.Text" xml:space="preserve">
<value>Total Remote Desktop Collections Created:</value>
</data>
</root>

View file

@ -153,4 +153,10 @@
<data name="locLblApplicationName" xml:space="preserve">
<value>Application Name</value>
</data>
<data name="btnExit.Text" xml:space="preserve">
<value>Back to Applications List</value>
</data>
<data name="btnSaveExit.Text" xml:space="preserve">
<value>Save Changes and Exit</value>
</data>
</root>

View file

@ -129,6 +129,9 @@
<data name="locEnableRedirection.Text" xml:space="preserve">
<value>Enable redirection for the following:</value>
</data>
<data name="locEncryptionLevel.Text" xml:space="preserve">
<value>Encryption Level</value>
</data>
<data name="locIdleSessionLimit.Text" xml:space="preserve">
<value>Idle session limit:</value>
</data>
@ -141,6 +144,9 @@
<data name="locPrinters.Text" xml:space="preserve">
<value>Printers</value>
</data>
<data name="locSecurityLayer.Text" xml:space="preserve">
<value>Security Layer</value>
</data>
<data name="locSessionLimitHeader.Text" xml:space="preserve">
<value>Set RD Session Host server timeout and reconnection settings for the session collection.</value>
</data>
@ -153,6 +159,9 @@
<data name="secRdsClientSettings.Text" xml:space="preserve">
<value>Client Settings</value>
</data>
<data name="secRdsSecuritySettings.Text" xml:space="preserve">
<value>Security Settings</value>
</data>
<data name="secRdsSessionSettings.Text" xml:space="preserve">
<value>Session Settings</value>
</data>

View file

@ -144,4 +144,7 @@
<data name="secRdsUsers.Text" xml:space="preserve">
<value>RDS Users</value>
</data>
<data name="locQuota.Text" xml:space="preserve">
<value>Total RDS Users Assigned:</value>
</data>
</root>

View file

@ -72,6 +72,11 @@
</asp:TemplateField>
</Columns>
</asp:GridView>
<div>
<asp:Localize ID="locQuota" runat="server" meta:resourcekey="locQuota" Text="RDS Servers:"></asp:Localize>
&nbsp;&nbsp;&nbsp;
<wsp:QuotaViewer ID="rdsServersQuota" runat="server" QuotaTypeId="2" DisplayGauge="true"/>
</div>
<asp:ObjectDataSource ID="odsRDSAssignedServersPaged" runat="server" EnablePaging="True"
SelectCountMethod="GetOrganizationRdsServersPagedCount"
SelectMethod="GetOrganizationRdsServersPaged"

View file

@ -41,18 +41,32 @@ namespace WebsitePanel.Portal.RDS
{
protected void Page_Load(object sender, EventArgs e)
{
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (!IsPostBack)
{
BindQuota(cntx);
}
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (cntx.Quotas.ContainsKey(Quotas.RDS_SERVERS))
{
btnAddServerToOrg.Enabled = (!(cntx.Quotas[Quotas.RDS_SERVERS].QuotaAllocatedValue <= gvRDSAssignedServers.Rows.Count) || (cntx.Quotas[Quotas.RDS_SERVERS].QuotaAllocatedValue == -1));
}
}
private void BindQuota(PackageContext cntx)
{
OrganizationStatistics stats = ES.Services.Organizations.GetOrganizationStatisticsByOrganization(PanelRequest.ItemID);
OrganizationStatistics tenantStats = ES.Services.Organizations.GetOrganizationStatistics(PanelRequest.ItemID);
rdsServersQuota.QuotaUsedValue = stats.CreatedRdsServers;
rdsServersQuota.QuotaValue = stats.AllocatedRdsServers;
if (stats.AllocatedUsers != -1)
{
rdsServersQuota.QuotaAvailable = tenantStats.AllocatedRdsServers - tenantStats.CreatedRdsServers;
}
}
protected void btnAddServerToOrg_Click(object sender, EventArgs e)
{
Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_add_server",

View file

@ -1,31 +1,3 @@
// Copyright (c) 2015, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@ -139,6 +111,24 @@ namespace WebsitePanel.Portal.RDS {
/// </remarks>
protected global::System.Web.UI.WebControls.GridView gvRDSAssignedServers;
/// <summary>
/// locQuota control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locQuota;
/// <summary>
/// rdsServersQuota control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer rdsServersQuota;
/// <summary>
/// odsRDSAssignedServersPaged control.
/// </summary>

View file

@ -48,7 +48,7 @@
<asp:TemplateField HeaderText="gvCollectionName" SortExpression="DisplayName">
<ItemStyle Width="40%"></ItemStyle>
<ItemTemplate>
<asp:hyperlink id="lnkCollectionName" meta:resourcekey="lnkApps" runat="server" NavigateUrl='<%# GetCollectionEditUrl(Eval("Id").ToString()) %>'><%# Eval("DisplayName").ToString() %></asp:hyperlink>
<asp:LinkButton id="lnkCollectionName" meta:resourcekey="lnkCollectionName" runat="server" CommandName="EditCollection" CommandArgument='<%# Eval("Id") %>' OnClientClick="ShowProgressDialog('Loading ...');return true;"><%# Eval("DisplayName").ToString() %></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvServer">
@ -66,6 +66,11 @@
</asp:TemplateField>
</Columns>
</asp:GridView>
<div>
<asp:Localize ID="locQuota" runat="server" meta:resourcekey="locQuota" Text="Collections Created:"></asp:Localize>
&nbsp;&nbsp;&nbsp;
<wsp:QuotaViewer ID="collectionsQuota" runat="server" QuotaTypeId="2" DisplayGauge="true" />
</div>
<asp:ObjectDataSource ID="odsRDSCollectionsPaged" runat="server" EnablePaging="True"
SelectCountMethod="GetRDSCollectonsPagedCount"
SelectMethod="GetRDSCollectonsPaged"

View file

@ -42,17 +42,32 @@ namespace WebsitePanel.Portal.RDS
{
protected void Page_Load(object sender, EventArgs e)
{
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (!IsPostBack)
{
BindQuota(cntx);
}
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (cntx.Quotas.ContainsKey(Quotas.RDS_COLLECTIONS))
{
btnAddCollection.Enabled = (!(cntx.Quotas[Quotas.RDS_COLLECTIONS].QuotaAllocatedValue <= gvRDSCollections.Rows.Count) || (cntx.Quotas[Quotas.RDS_COLLECTIONS].QuotaAllocatedValue == -1));
}
}
private void BindQuota(PackageContext cntx)
{
OrganizationStatistics stats = ES.Services.Organizations.GetOrganizationStatisticsByOrganization(PanelRequest.ItemID);
OrganizationStatistics tenantStats = ES.Services.Organizations.GetOrganizationStatistics(PanelRequest.ItemID);
collectionsQuota.QuotaUsedValue = stats.CreatedRdsCollections;
collectionsQuota.QuotaValue = stats.AllocatedRdsCollections;
if (stats.AllocatedUsers != -1)
{
collectionsQuota.QuotaAvailable = tenantStats.AllocatedRdsCollections - tenantStats.CreatedRdsCollections;
}
}
public string GetServerName(string collectionId)
{
int id = int.Parse(collectionId);
@ -95,6 +110,10 @@ namespace WebsitePanel.Portal.RDS
ShowErrorMessage("REMOTE_DESKTOP_SERVICES_REMOVE_COLLECTION", ex);
}
}
else if (e.CommandName == "EditCollection")
{
Response.Redirect(GetCollectionEditUrl(e.CommandArgument.ToString()));
}
}
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)

View file

@ -111,6 +111,24 @@ namespace WebsitePanel.Portal.RDS {
/// </remarks>
protected global::System.Web.UI.WebControls.GridView gvRDSCollections;
/// <summary>
/// locQuota control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locQuota;
/// <summary>
/// collectionsQuota control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer collectionsQuota;
/// <summary>
/// odsRDSCollectionsPaged control.
/// </summary>

View file

@ -30,26 +30,6 @@
</tr>
</table>
<wsp:CollapsiblePanel id="secSelectSertificate" runat="server"
TargetControlID="panelSelectSertificate" meta:resourcekey="secSelectSertificate" Text="">
</wsp:CollapsiblePanel>
<asp:Panel runat="server" ID="panelSelectSertificate">
<div style="padding: 10px;">
<div class="FormBody">
<div class="FormField">
<asp:FileUpload ID="upPFX" runat="server"/>
</div>
<div class="FormFieldDescription">
<asp:Localize runat="server" meta:resourcekey="lblPFXInstallPassword" />
</div>
<div class="FormField">
<asp:TextBox ID="txtPFXInstallPassword" runat="server" TextMode="Password" CssClass="NormalTextBox" />
</div>
</div>
</div>
</asp:Panel>
<fieldset id="RDSServersPanel" runat="server">
<legend><asp:Localize ID="locRDSServersSection" runat="server" meta:resourcekey="locRDSServersSection" Text="RDS Servers"></asp:Localize></legend>
<div style="padding: 10px;">

View file

@ -64,6 +64,7 @@ namespace WebsitePanel.Portal.RDS
RdsCollection collection = new RdsCollection{ Name = txtCollectionName.Text, DisplayName = txtCollectionName.Text, Servers = servers.GetServers(), Description = "" };
int collectionId = ES.Services.RDS.AddRdsCollection(PanelRequest.ItemID, collection);
Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "rds_edit_collection", "CollectionId=" + collectionId, "ItemID=" + PanelRequest.ItemID));
}
catch (Exception ex)

View file

@ -75,42 +75,6 @@ namespace WebsitePanel.Portal.RDS {
/// </remarks>
protected global::System.Web.UI.WebControls.RequiredFieldValidator valCollectionName;
/// <summary>
/// secSelectSertificate control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secSelectSertificate;
/// <summary>
/// panelSelectSertificate control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel panelSelectSertificate;
/// <summary>
/// upPFX control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.FileUpload upPFX;
/// <summary>
/// txtPFXInstallPassword control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtPFXInstallPassword;
/// <summary>
/// RDSServersPanel control.
/// </summary>

View file

@ -55,8 +55,12 @@
</div>
</asp:Panel>
<div class="FormFooterClean">
<wsp:ItemButtonPanel id="buttonPanel" runat="server" ValidationGroup="SaveRDSCollection"
OnSaveClick="btnSave_Click" OnSaveExitClick="btnSaveExit_Click" />
<asp:Button id="btnSave" runat="server" Text="Save Changes" CssClass="Button1" meta:resourcekey="btnSave"
OnClick="btnSave_Click" OnClientClick="ShowProgressDialog('Updating ...');"></asp:Button>
<asp:Button id="btnSaveExit" runat="server" Text="Save Changes and Exit" CssClass="Button1" meta:resourcekey="btnSaveExit"
OnClick="btnSaveExit_Click" OnClientClick="ShowProgressDialog('Updating ...');"></asp:Button>
<asp:Button id="btnExit" runat="server" Text="Back to Applications List" CssClass="Button1" meta:resourcekey="btnExit"
OnClick="btnExit_Click" OnClientClick="ShowProgressDialog('Loading ...');"></asp:Button>
</div>
</div>
</div>

View file

@ -100,5 +100,10 @@ namespace WebsitePanel.Portal.RDS
Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "rds_collection_edit_apps", "CollectionId=" + PanelRequest.CollectionID, "ItemID=" + PanelRequest.ItemID));
}
}
protected void btnExit_Click(object sender, EventArgs e)
{
Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "rds_collection_edit_apps", "CollectionId=" + PanelRequest.CollectionID, "ItemID=" + PanelRequest.ItemID));
}
}
}

View file

@ -139,12 +139,30 @@ namespace WebsitePanel.Portal.RDS {
protected global::WebsitePanel.Portal.RDS.UserControls.RDSCollectionUsers users;
/// <summary>
/// buttonPanel control.
/// btnSave control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ItemButtonPanel buttonPanel;
protected global::System.Web.UI.WebControls.Button btnSave;
/// <summary>
/// btnSaveExit control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnSaveExit;
/// <summary>
/// btnExit control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnExit;
}
}

View file

@ -175,6 +175,43 @@
</div>
</asp:Panel>
<wsp:CollapsiblePanel id="secRdsSecuritySettings" runat="server"
TargetControlID="panelRdsSecuritySettings" meta:resourcekey="secRdsSecuritySettings" Text="">
</wsp:CollapsiblePanel>
<asp:Panel runat="server" ID="panelRdsSecuritySettings">
<div style="padding: 10px;">
<table>
<tr>
<td class="Label" style="width:260px;"><asp:Localize ID="locSecurityLayer" runat="server" meta:resourcekey="locSecurityLayer" Text=""></asp:Localize></td>
<td style="width:250px;">
<asp:DropDownList ID="ddSecurityLayer" runat="server" CssClass="NormalTextBox">
<asp:ListItem Value="RDP" Text="RDP Security Layer" />
<asp:ListItem Value="Negotiate" Text="Negotiate" />
<asp:ListItem Value="SSL" Text="SSL (TLS 1.0)" />
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="Label" style="width:260px;"><asp:Localize ID="locEncryptionLevel" runat="server" meta:resourcekey="locEncryptionLevel" Text=""></asp:Localize></td>
<td style="width:250px;">
<asp:DropDownList ID="ddEncryptionLevel" runat="server" CssClass="NormalTextBox">
<asp:ListItem Value="Low" Text="Low" />
<asp:ListItem Value="ClientCompatible" Text="Client Compatible" />
<asp:ListItem Value="High" Text="High" />
<asp:ListItem Value="FipsCompliant" Text="FIPS Compliant" />
</asp:DropDownList>
</td>
</tr>
<tr>
<td colspan="2">
<asp:CheckBox ID="cbAuthentication" Text="Allow connections only from computers runnig Remote Desktop with Network Level Authentication" runat="server"/>
</td>
</tr>
</table>
</div>
</asp:Panel>
<div class="FormFooterClean">
<wsp:ItemButtonPanel id="buttonPanel" runat="server" ValidationGroup="SaveRDSCollection"
OnSaveClick="btnSave_Click" OnSaveExitClick="btnSaveExit_Click" />

View file

@ -43,7 +43,10 @@ namespace WebsitePanel.Portal.RDS
ClientPrinterRedirected = true,
ClientPrinterAsDefault = true,
RDEasyPrintDriverEnabled = true,
MaxRedirectedMonitors = 16
MaxRedirectedMonitors = 16,
EncryptionLevel = EncryptionLevel.ClientCompatible.ToString(),
SecurityLayer = SecurityLayerValues.Negotiate.ToString(),
AuthenticateUsingNLA = true
};
}
@ -89,6 +92,9 @@ namespace WebsitePanel.Portal.RDS
chEasyPrint.Checked = collection.Settings.RDEasyPrintDriverEnabled;
chEasyPrint.Enabled = collection.Settings.ClientPrinterRedirected;
tbMonitorsNumber.Text = collection.Settings.MaxRedirectedMonitors.ToString();
cbAuthentication.Checked = collection.Settings.AuthenticateUsingNLA;
ddSecurityLayer.SelectedValue = collection.Settings.SecurityLayer;
ddEncryptionLevel.SelectedValue = collection.Settings.EncryptionLevel;
}
private bool EditCollectionSettings()
@ -165,6 +171,9 @@ namespace WebsitePanel.Portal.RDS
}
settings.ClientDeviceRedirectionOptions = string.Join(",", redirectionOptions.ToArray());
settings.AuthenticateUsingNLA = cbAuthentication.Checked;
settings.SecurityLayer = ddSecurityLayer.SelectedItem.Value;
settings.EncryptionLevel = ddEncryptionLevel.SelectedItem.Value;
return settings;
}

View file

@ -354,6 +354,69 @@ namespace WebsitePanel.Portal.RDS {
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox tbMonitorsNumber;
/// <summary>
/// secRdsSecuritySettings control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secRdsSecuritySettings;
/// <summary>
/// panelRdsSecuritySettings control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel panelRdsSecuritySettings;
/// <summary>
/// locSecurityLayer control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locSecurityLayer;
/// <summary>
/// ddSecurityLayer control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddSecurityLayer;
/// <summary>
/// locEncryptionLevel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locEncryptionLevel;
/// <summary>
/// ddEncryptionLevel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddEncryptionLevel;
/// <summary>
/// cbAuthentication control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox cbAuthentication;
/// <summary>
/// buttonPanel control.
/// </summary>

View file

@ -1,6 +1,7 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDSEditCollectionUsers.ascx.cs" Inherits="WebsitePanel.Portal.RDS.RDSEditCollectionUsers" %>
<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/QuotaViewer.ascx" TagName="QuotaViewer" TagPrefix="wsp" %>
<%@ Register Src="UserControls/RDSCollectionUsers.ascx" TagName="CollectionUsers" TagPrefix="wsp"%>
<%@ Register Src="UserControls/RDSCollectionTabs.ascx" TagName="CollectionTabs" TagPrefix="wsp" %>
<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../UserControls/CollapsiblePanel.ascx" %>
@ -34,6 +35,11 @@
<wsp:CollectionUsers id="users" runat="server" />
</div>
</asp:Panel>
<div>
<asp:Localize ID="locQuota" runat="server" meta:resourcekey="locQuota" Text="Users Created:"></asp:Localize>
&nbsp;&nbsp;&nbsp;
<wsp:QuotaViewer ID="usersQuota" runat="server" QuotaTypeId="2" DisplayGauge="true" />
</div>
<div class="FormFooterClean">
<wsp:ItemButtonPanel id="buttonPanel" runat="server" ValidationGroup="SaveRDSCollection"
OnSaveClick="btnSave_Click" OnSaveExitClick="btnSaveExit_Click" />

View file

@ -42,6 +42,7 @@ namespace WebsitePanel.Portal.RDS
{
if (!IsPostBack)
{
BindQuota();
var collectionUsers = ES.Services.RDS.GetRdsCollectionUsers(PanelRequest.CollectionID);
var collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID);
@ -50,6 +51,20 @@ namespace WebsitePanel.Portal.RDS
}
}
private void BindQuota()
{
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
OrganizationStatistics stats = ES.Services.Organizations.GetOrganizationStatisticsByOrganization(PanelRequest.ItemID);
OrganizationStatistics tenantStats = ES.Services.Organizations.GetOrganizationStatistics(PanelRequest.ItemID);
usersQuota.QuotaUsedValue = stats.CreatedRdsUsers;
usersQuota.QuotaValue = stats.AllocatedRdsUsers;
if (stats.AllocatedUsers != -1)
{
usersQuota.QuotaAvailable = tenantStats.AllocatedRdsUsers - tenantStats.CreatedRdsUsers;
}
}
private bool SaveRdsUsers()
{
try
@ -73,6 +88,7 @@ namespace WebsitePanel.Portal.RDS
}
SaveRdsUsers();
BindQuota();
}
protected void btnSaveExit_Click(object sender, EventArgs e)

View file

@ -93,6 +93,24 @@ namespace WebsitePanel.Portal.RDS {
/// </remarks>
protected global::WebsitePanel.Portal.RDS.UserControls.RDSCollectionUsers users;
/// <summary>
/// locQuota control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize locQuota;
/// <summary>
/// usersQuota control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.QuotaViewer usersQuota;
/// <summary>
/// buttonPanel control.
/// </summary>

View file

@ -42,6 +42,7 @@
<asp:TemplateField meta:resourcekey="gvUserName" HeaderText="gvUserName">
<ItemStyle Width="30%" Wrap="false"/>
<ItemTemplate>
<asp:Image ID="vipImage" runat="server" ImageUrl='<%# GetAccountImage(Convert.ToBoolean(Eval("IsVip"))) %>' ImageAlign="AbsMiddle"/>
<asp:Literal ID="litUserName" runat="server" Text='<%# Eval("UserName") %>'/>
<asp:HiddenField ID="hfUnifiedSessionId" runat="server" Value='<%# Eval("UnifiedSessionId") %>'/>
</ItemTemplate>

View file

@ -5,6 +5,8 @@ using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.RemoteDesktopServices;
namespace WebsitePanel.Portal.RDS
@ -101,5 +103,15 @@ namespace WebsitePanel.Portal.RDS
gvRDSUserSessions.DataSource = userSessions;
gvRDSUserSessions.DataBind();
}
public string GetAccountImage(bool vip)
{
if (vip)
{
return GetThemedImage("Exchange/vip_user_16.png");
}
return GetThemedImage("Exchange/accounting_mail_16.png");
}
}
}

View file

@ -1,4 +1,5 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDSCollectionApps.ascx.cs" Inherits="WebsitePanel.Portal.RDS.UserControls.RDSCollectionApps" %>
<%@ Import Namespace="WebsitePanel.Portal" %>
<%@ Register Src="../../UserControls/PopupHeader.ascx" TagName="PopupHeader" TagPrefix="wsp" %>
<asp:UpdatePanel ID="RDAppsUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
@ -8,7 +9,7 @@
<asp:Button ID="btnDelete" runat="server" Text="Delete" CssClass="Button1" OnClick="btnDelete_Click" meta:resourcekey="btnDelete"/>
</div>
<asp:GridView ID="gvApps" runat="server" meta:resourcekey="gvApps" AutoGenerateColumns="False"
Width="600px" CssSelectorClass="NormalGridView"
Width="600px" CssSelectorClass="NormalGridView" OnRowCommand="gvApps_RowCommand"
DataKeyNames="Alias">
<Columns>
<asp:TemplateField>
@ -24,11 +25,17 @@
<ItemStyle Width="90%" Wrap="false">
</ItemStyle>
<ItemTemplate>
<asp:hyperlink id="lnkDisplayName" meta:resourcekey="lnkDisplayName" runat="server" Text='<%# Eval("DisplayName") %>' NavigateUrl='<%# GetCollectionUsersEditUrl(Eval("Alias").ToString()) %>'/>
<asp:LinkButton id="lnkDisplayName" meta:resourcekey="lnkDisplayName" runat="server" Text='<%# Eval("DisplayName")%>' CommandName="EditApplication" CommandArgument='<%# Eval("Alias") %>' OnClientClick="ShowProgressDialog('Loading ...');return true;"/>
<asp:HiddenField ID="hfFilePath" runat="server" Value='<%# Eval("FilePath") %>'/>
<asp:HiddenField ID="hfRequiredCommandLine" runat="server" Value='<%# Eval("RequiredCommandLine") %>'/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemStyle Width="20px" />
<ItemTemplate>
<asp:Image ID="UsersImage" ImageUrl='<%# PortalUtils.GetThemedImage("Exchange/accounting_mail_16.png")%>' runat="server" Visible='<%# Eval("Users") != null %>'/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />

View file

@ -210,7 +210,7 @@ namespace WebsitePanel.Portal.RDS.UserControls
RemoteApplication app = new RemoteApplication();
app.Alias = (string)gvApps.DataKeys[i][0];
app.DisplayName = ((HyperLink)row.FindControl("lnkDisplayName")).Text;
app.DisplayName = ((LinkButton)row.FindControl("lnkDisplayName")).Text;
app.FilePath = ((HiddenField)row.FindControl("hfFilePath")).Value;
app.RequiredCommandLine = ((HiddenField)row.FindControl("hfRequiredCommandLine")).Value;
@ -254,6 +254,14 @@ namespace WebsitePanel.Portal.RDS.UserControls
BindPopupApps();
}
protected void gvApps_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "EditApplication")
{
Response.Redirect(GetCollectionUsersEditUrl(e.CommandArgument.ToString()));
}
}
protected SortDirection Direction
{
get { return ViewState[DirectionString] == null ? SortDirection.Descending : (SortDirection)ViewState[DirectionString]; }

View file

@ -5,12 +5,19 @@
<%@ Register Src="UserControls/UserDetails.ascx" TagName="UserDetails" TagPrefix="uc2" %>
<%@ Register Src="UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %>
<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %>
<%@ Register Src="UserControls/PopupHeader.ascx" TagName="PopupHeader" TagPrefix="wsp" %>
<%@ Register Src="UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
<asp:UpdatePanel runat="server" ID="messageBoxPanel" UpdateMode="Conditional">
<ContentTemplate>
<wsp:SimpleMessageBox id="messageBox" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel runat="server" ID="updatePanelUsers">
<ContentTemplate>
<wsp:SimpleMessageBox id="messageBox" runat="server" />
<div class="FormButtonsBar">
<div class="Left">
<asp:Button ID="btnAddRDSServer" runat="server"
@ -43,11 +50,45 @@
<Columns>
<asp:BoundField DataField="Name" HtmlEncode="true" SortExpression="Name" HeaderText="Server name">
<HeaderStyle Wrap="false" />
<ItemStyle Wrap="False" Width="25%"/>
<ItemStyle Wrap="False" Width="15%"/>
</asp:BoundField>
<asp:BoundField DataField="Address" HeaderText="IP Address"><ItemStyle Width="15%"/></asp:BoundField>
<asp:BoundField DataField="ItemName" HeaderText="Organization"><ItemStyle Width="20%"/></asp:BoundField>
<asp:BoundField DataField="Description" HeaderText="Comments"><ItemStyle Width="30%"/></asp:BoundField>
<asp:BoundField DataField="Address" HeaderText="IP Address"><ItemStyle Width="10%"/></asp:BoundField>
<asp:BoundField DataField="ItemName" HeaderText="Organization"><ItemStyle Width="10%"/></asp:BoundField>
<asp:BoundField DataField="Description" HeaderText="Comments"><ItemStyle Width="20%"/></asp:BoundField>
<asp:TemplateField meta:resourcekey="gvPopupStatus">
<ItemStyle Width="20%" HorizontalAlign="Left" />
<ItemTemplate>
<asp:Literal ID="litStatus" runat="server" Text='<%# Eval("Status") %>'></asp:Literal>
<asp:HiddenField ID="hdnRdsCollectionId" runat="server" Value='<%# Eval("RdsCollectionId") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvViewInfo">
<ItemStyle Width="8%" HorizontalAlign="Right"/>
<ItemTemplate>
<asp:LinkButton OnClientClick="ShowProgressDialog('Getting Server Info ...');return true;" Visible='<%# Eval("Status") != null && Eval("Status").ToString().StartsWith("Online") %>' CommandName="ViewInfo" CommandArgument='<%# Eval("Id")%>' ID="lbViewInfo" runat="server" Text="View Info"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvRestart">
<ItemStyle HorizontalAlign="Right"/>
<ItemTemplate>
<asp:LinkButton ID="lbRestart" CommandName="Restart" CommandArgument='<%# Eval("Id")%>' Visible='<%# Eval("Status") != null && Eval("Status").ToString().StartsWith("Online") %>'
runat="server" Text="Restart" OnClientClick="if(confirm('Are you sure you want to restart selected server?')) ShowProgressDialog('Loading...'); else return false;"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvShutdown">
<ItemStyle Width="9%" HorizontalAlign="Right"/>
<ItemTemplate>
<asp:LinkButton ID="lbShutdown" CommandName="ShutDown" CommandArgument='<%# Eval("Id")%>' Visible='<%# Eval("Status") != null && Eval("Status").ToString().StartsWith("Online") %>'
runat="server" Text="Shut Down" OnClientClick="if(confirm('Are you sure you want to shut down selected server?')) ShowProgressDialog('Loading...'); else return false;"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkInstallCertificate" runat="server" Text="Certificate" Visible='<%# Eval("ItemId") != null && Eval("Status") != null && Eval("Status").ToString().StartsWith("Online") %>'
CommandName="InstallCertificate" CommandArgument='<%# Eval("Id") %>' ToolTip="Repair Certificate"
OnClientClick="if(confirm('Are you sure you want to install certificate?')) ShowProgressDialog('Installing certificate...'); else return false;"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkRemove" runat="server" Text="Remove" Visible='<%# Eval("ItemId") == null %>'
@ -63,5 +104,104 @@
<asp:ControlParameter Name="filterValue" ControlID="txtSearchValue" PropertyName="Text" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:Panel ID="ServerInfoPanel" runat="server" CssClass="Popup" style="display:none">
<table class="Popup-Header" cellpadding="0" cellspacing="0">
<tr>
<td class="Popup-HeaderLeft"/>
<td class="Popup-HeaderTitle">
<asp:Localize ID="Localize1" runat="server" meta:resourcekey="headerServerInfo"/>
</td>
<td class="Popup-HeaderRight"/>
</tr>
</table>
<div class="Popup-Content">
<div class="Popup-Body">
<br />
<asp:UpdatePanel ID="serverInfoUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<div class="Popup-Scroll" style="height:auto;">
<wsp:CollapsiblePanel id="secServerInfo" runat="server" TargetControlID="panelHardwareInfo" meta:resourcekey="secRdsApplicationEdit" Text=""/>
<asp:Panel runat="server" ID="panelHardwareInfo">
<table>
<tr>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="locProcessor" runat="server" Text="Processor:"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litProcessor" runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="locLoadPercentage" Text="Load Percentage:" runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litLoadPercentage" runat="server"/>
</td>
</tr>
<tr>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="locMemoryAllocated" runat="server" Text="Allocated Memory:"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litMemoryAllocated" runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="locFreeMemory" Text="Free Memory:" runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litFreeMemory" runat="server"/>
</td>
</tr>
</table>
</asp:Panel>
<wsp:CollapsiblePanel id="secRdsApplicationEdit" runat="server" TargetControlID="panelDiskDrives" meta:resourcekey="secRdsApplicationEdit" Text="Disk Drives"/>
<asp:Panel runat="server" ID="panelDiskDrives">
<table>
<asp:Repeater ID="rpServerDrives" runat="server" EnableViewState="false">
<ItemTemplate>
<tr>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litDeviceId" runat="server" Text='<%# Eval("DeviceId") %>'/>
</td>
<td class="FormLabel150" style="width: 150px;"/>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="locVolumeName" Text="Volume Name:" runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litVolumeName" Text='<%# Eval("VolumeName") %>' runat="server"/>
</td>
</tr>
<tr>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="locSize" Text="Size:" runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litSize" Text='<%# Eval("SizeMb") + " MB" %>' runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="locFreeSpace" Text="Free Space:" runat="server"/>
</td>
<td class="FormLabel150" style="width: 150px;">
<asp:Literal ID="litFreeSpace" Text='<%# Eval("FreeSpaceMb") + " MB" %>' runat="server"/>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</asp:Panel>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<br />
</div>
<div class="FormFooter">
<asp:Button ID="btnCancelServerInfo" runat="server" CssClass="Button1" meta:resourcekey="btnServerInfoCancel" Text="Cancel" CausesValidation="false" />
</div>
</div>
</asp:Panel>
<asp:Button ID="btnViewInfoFake" runat="server" style="display:none;" />
<ajaxToolkit:ModalPopupExtender ID="ViewInfoModal" runat="server" TargetControlID="btnViewInfoFake" PopupControlID="ServerInfoPanel"
BackgroundCssClass="modalBackground" DropShadow="false" CancelControlID="btnCancelServerInfo"/>
</ContentTemplate>
</asp:UpdatePanel>

View file

@ -31,6 +31,7 @@ using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Linq;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
@ -39,6 +40,7 @@ using System.Web.UI.HtmlControls;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.Common;
using AjaxControlToolkit;
namespace WebsitePanel.Portal
{
@ -99,6 +101,28 @@ namespace WebsitePanel.Portal
ShowErrorMessage("REMOTE_DESKTOP_SERVICES_REMOVE_RDSSERVER", ex);
}
}
else if (e.CommandName == "ViewInfo")
{
try
{
ShowInfo(e.CommandArgument.ToString());
}
catch (Exception)
{
}
}
else if (e.CommandName == "Restart")
{
Restart(e.CommandArgument.ToString());
}
else if (e.CommandName == "ShutDown")
{
ShutDown(e.CommandArgument.ToString());
}
else if (e.CommandName == "InstallCertificate")
{
InstallCertificate(e.CommandArgument.ToString());
}
}
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
@ -107,5 +131,60 @@ namespace WebsitePanel.Portal
gvRDSServers.DataBind();
}
private void ShowInfo(string serverId)
{
ViewInfoModal.Show();
var rdsServer = ES.Services.RDS.GetRdsServer(Convert.ToInt32(serverId));
var serverInfo = ES.Services.RDS.GetRdsServerInfo(rdsServer.ItemId.Value, rdsServer.FqdName);
litProcessor.Text = string.Format("{0}x{1} MHz", serverInfo.NumberOfCores, serverInfo.MaxClockSpeed);
litLoadPercentage.Text = string.Format("{0}%", serverInfo.LoadPercentage);
litMemoryAllocated.Text = string.Format("{0} MB", serverInfo.MemoryAllocatedMb);
litFreeMemory.Text = string.Format("{0} MB", serverInfo.FreeMemoryMb);
rpServerDrives.DataSource = serverInfo.Drives;
rpServerDrives.DataBind();
((ModalPopupExtender)asyncTasks.FindControl("ModalPopupProperties")).Hide();
}
private void Restart(string serverId)
{
var rdsServer = ES.Services.RDS.GetRdsServer(Convert.ToInt32(serverId));
ES.Services.RDS.RestartRdsServer(rdsServer.ItemId.Value, rdsServer.FqdName);
Response.Redirect(Request.Url.ToString(), true);
}
private void ShutDown(string serverId)
{
var rdsServer = ES.Services.RDS.GetRdsServer(Convert.ToInt32(serverId));
ES.Services.RDS.ShutDownRdsServer(rdsServer.ItemId.Value, rdsServer.FqdName);
Response.Redirect(Request.Url.ToString(), true);
}
private void RefreshServerInfo()
{
var servers = odsRDSServersPaged.Select();
gvRDSServers.DataSource = servers;
gvRDSServers.DataBind();
((ModalPopupExtender)asyncTasks.FindControl("ModalPopupProperties")).Hide();
}
private void InstallCertificate(string serverId)
{
var rdsServer = ES.Services.RDS.GetRdsServer(Convert.ToInt32(serverId));
try
{
ES.Services.RDS.InstallSessionHostsCertificate(rdsServer);
((ModalPopupExtender)asyncTasks.FindControl("ModalPopupProperties")).Hide();
ShowSuccessMessage("RDSSESSIONHOST_CERTIFICATE_INSTALLED");
}
catch(Exception ex)
{
ShowErrorMessage("RDSSESSIONHOST_CERTIFICATE_NOT_INSTALLED", ex);
}
messageBoxPanel.Update();
// Response.Redirect(Request.Url.ToString(), true);
}
}
}

View file

@ -1,31 +1,3 @@
// Copyright (c) 2015, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@ -41,13 +13,22 @@ namespace WebsitePanel.Portal {
public partial class RDSServers {
/// <summary>
/// updatePanelUsers control.
/// asyncTasks control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel updatePanelUsers;
protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks;
/// <summary>
/// messageBoxPanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel messageBoxPanel;
/// <summary>
/// messageBox control.
@ -58,6 +39,15 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
/// <summary>
/// updatePanelUsers control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel updatePanelUsers;
/// <summary>
/// btnAddRDSServer control.
/// </summary>
@ -129,5 +119,176 @@ namespace WebsitePanel.Portal {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource odsRDSServersPaged;
/// <summary>
/// ServerInfoPanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel ServerInfoPanel;
/// <summary>
/// Localize1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize Localize1;
/// <summary>
/// serverInfoUpdatePanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel serverInfoUpdatePanel;
/// <summary>
/// secServerInfo control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secServerInfo;
/// <summary>
/// panelHardwareInfo control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel panelHardwareInfo;
/// <summary>
/// locProcessor control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal locProcessor;
/// <summary>
/// litProcessor control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litProcessor;
/// <summary>
/// locLoadPercentage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal locLoadPercentage;
/// <summary>
/// litLoadPercentage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litLoadPercentage;
/// <summary>
/// locMemoryAllocated control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal locMemoryAllocated;
/// <summary>
/// litMemoryAllocated control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litMemoryAllocated;
/// <summary>
/// locFreeMemory control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal locFreeMemory;
/// <summary>
/// litFreeMemory control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litFreeMemory;
/// <summary>
/// secRdsApplicationEdit control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secRdsApplicationEdit;
/// <summary>
/// panelDiskDrives control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel panelDiskDrives;
/// <summary>
/// rpServerDrives control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Repeater rpServerDrives;
/// <summary>
/// btnCancelServerInfo control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnCancelServerInfo;
/// <summary>
/// btnViewInfoFake control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnViewInfoFake;
/// <summary>
/// ViewInfoModal control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::AjaxControlToolkit.ModalPopupExtender ViewInfoModal;
}
}

View file

@ -65,7 +65,7 @@ function nchar(num) {
function getRandomChars(_charsRange, _length, _target) {
var _arr = [];
var l1 = _charsRange[0];
var rest = _charsRange[1] - _charsRange[0];
var rest = _charsRange[1] - _charsRange[0] + 1;
//
while (_arr.length < _length) {
var charCode = Math.floor(Math.random() * rest);

View file

@ -5714,7 +5714,9 @@
<Content Include="VPSForPC\App_LocalResources\VpsDetailsGeneral.ascx.resx">
<SubType>Designer</SubType>
</Content>
<Content Include="App_LocalResources\WebsitesSSL.ascx.resx" />
<Content Include="App_LocalResources\WebsitesSSL.ascx.resx">
<SubType>Designer</SubType>
</Content>
<Content Include="VPSForPC\App_LocalResources\VpsDetailsHelp.ascx.resx">
<SubType>Designer</SubType>
</Content>