diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs
index 5b87a4eb..aa2f44e7 100644
--- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs
+++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs
@@ -100,6 +100,10 @@ namespace WebsitePanel.EnterpriseServer {
private System.Threading.SendOrPostCallback SetApplicationUsersOperationCompleted;
+ private System.Threading.SendOrPostCallback GetRdsUserSessionsOperationCompleted;
+
+ private System.Threading.SendOrPostCallback LogOffRdsUserOperationCompleted;
+
///
public esRemoteDesktopServices() {
this.Url = "http://localhost:9002/esRemoteDesktopServices.asmx";
@@ -210,6 +214,12 @@ namespace WebsitePanel.EnterpriseServer {
///
public event SetApplicationUsersCompletedEventHandler SetApplicationUsersCompleted;
+ ///
+ public event GetRdsUserSessionsCompletedEventHandler GetRdsUserSessionsCompleted;
+
+ ///
+ public event LogOffRdsUserCompletedEventHandler LogOffRdsUserCompleted;
+
///
[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) {
@@ -1800,6 +1810,94 @@ namespace WebsitePanel.EnterpriseServer {
}
}
+ ///
+ [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsUserSessions", 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 RdsUserSession[] GetRdsUserSessions(int collectionId) {
+ object[] results = this.Invoke("GetRdsUserSessions", new object[] {
+ collectionId});
+ return ((RdsUserSession[])(results[0]));
+ }
+
+ ///
+ public System.IAsyncResult BeginGetRdsUserSessions(int collectionId, System.AsyncCallback callback, object asyncState) {
+ return this.BeginInvoke("GetRdsUserSessions", new object[] {
+ collectionId}, callback, asyncState);
+ }
+
+ ///
+ public RdsUserSession[] EndGetRdsUserSessions(System.IAsyncResult asyncResult) {
+ object[] results = this.EndInvoke(asyncResult);
+ return ((RdsUserSession[])(results[0]));
+ }
+
+ ///
+ public void GetRdsUserSessionsAsync(int collectionId) {
+ this.GetRdsUserSessionsAsync(collectionId, null);
+ }
+
+ ///
+ public void GetRdsUserSessionsAsync(int collectionId, object userState) {
+ if ((this.GetRdsUserSessionsOperationCompleted == null)) {
+ this.GetRdsUserSessionsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRdsUserSessionsOperationCompleted);
+ }
+ this.InvokeAsync("GetRdsUserSessions", new object[] {
+ collectionId}, this.GetRdsUserSessionsOperationCompleted, userState);
+ }
+
+ private void OnGetRdsUserSessionsOperationCompleted(object arg) {
+ if ((this.GetRdsUserSessionsCompleted != null)) {
+ System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
+ this.GetRdsUserSessionsCompleted(this, new GetRdsUserSessionsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
+ }
+ }
+
+ ///
+ [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/LogOffRdsUser", 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 LogOffRdsUser(int itemId, string unifiedSessionId, string hostServer) {
+ object[] results = this.Invoke("LogOffRdsUser", new object[] {
+ itemId,
+ unifiedSessionId,
+ hostServer});
+ return ((ResultObject)(results[0]));
+ }
+
+ ///
+ public System.IAsyncResult BeginLogOffRdsUser(int itemId, string unifiedSessionId, string hostServer, System.AsyncCallback callback, object asyncState) {
+ return this.BeginInvoke("LogOffRdsUser", new object[] {
+ itemId,
+ unifiedSessionId,
+ hostServer}, callback, asyncState);
+ }
+
+ ///
+ public ResultObject EndLogOffRdsUser(System.IAsyncResult asyncResult) {
+ object[] results = this.EndInvoke(asyncResult);
+ return ((ResultObject)(results[0]));
+ }
+
+ ///
+ public void LogOffRdsUserAsync(int itemId, string unifiedSessionId, string hostServer) {
+ this.LogOffRdsUserAsync(itemId, unifiedSessionId, hostServer, null);
+ }
+
+ ///
+ public void LogOffRdsUserAsync(int itemId, string unifiedSessionId, string hostServer, object userState) {
+ if ((this.LogOffRdsUserOperationCompleted == null)) {
+ this.LogOffRdsUserOperationCompleted = new System.Threading.SendOrPostCallback(this.OnLogOffRdsUserOperationCompleted);
+ }
+ this.InvokeAsync("LogOffRdsUser", new object[] {
+ itemId,
+ unifiedSessionId,
+ hostServer}, this.LogOffRdsUserOperationCompleted, userState);
+ }
+
+ private void OnLogOffRdsUserOperationCompleted(object arg) {
+ if ((this.LogOffRdsUserCompleted != null)) {
+ System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
+ this.LogOffRdsUserCompleted(this, new LogOffRdsUserCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
+ }
+ }
+
///
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
@@ -2715,4 +2813,56 @@ namespace WebsitePanel.EnterpriseServer {
}
}
}
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
+ public delegate void GetRdsUserSessionsCompletedEventHandler(object sender, GetRdsUserSessionsCompletedEventArgs e);
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ public partial class GetRdsUserSessionsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
+
+ private object[] results;
+
+ internal GetRdsUserSessionsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
+ base(exception, cancelled, userState) {
+ this.results = results;
+ }
+
+ ///
+ public RdsUserSession[] Result {
+ get {
+ this.RaiseExceptionIfNecessary();
+ return ((RdsUserSession[])(this.results[0]));
+ }
+ }
+ }
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
+ public delegate void LogOffRdsUserCompletedEventHandler(object sender, LogOffRdsUserCompletedEventArgs e);
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ public partial class LogOffRdsUserCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
+
+ private object[] results;
+
+ internal LogOffRdsUserCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
+ base(exception, cancelled, userState) {
+ this.results = results;
+ }
+
+ ///
+ public ResultObject Result {
+ get {
+ this.RaiseExceptionIfNecessary();
+ return ((ResultObject)(this.results[0]));
+ }
+ }
+ }
}
diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs
index 67ab6ab2..87ea9dac 100644
--- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs
+++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs
@@ -103,6 +103,11 @@ namespace WebsitePanel.EnterpriseServer
return GetRdsServersPagedInternal(filterColumn, filterValue, sortColumn, startRow, maximumRows);
}
+ public static List GetRdsUserSessions(int collectionId)
+ {
+ return GetRdsUserSessionsInternal(collectionId);
+ }
+
public static RdsServersPaged GetFreeRdsServersPaged(int packageId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows)
{
return GetFreeRdsServersPagedInternal(packageId, filterColumn, filterValue, sortColumn, startRow, maximumRows);
@@ -233,6 +238,11 @@ namespace WebsitePanel.EnterpriseServer
return SetApplicationUsersInternal(itemId, collectionId, remoteApp, users);
}
+ public static ResultObject LogOffRdsUser(int itemId, string unifiedSessionId, string hostServer)
+ {
+ return LogOffRdsUserInternal(itemId, unifiedSessionId, hostServer);
+ }
+
private static RdsCollection GetRdsCollectionInternal(int collectionId)
{
var collection = ObjectUtils.FillObjectFromDataReader(DataProvider.GetRDSCollectionById(collectionId));
@@ -579,6 +589,22 @@ namespace WebsitePanel.EnterpriseServer
return result;
}
+ private static List GetRdsUserSessionsInternal(int collectionId)
+ {
+ var result = new List();
+ var collection = ObjectUtils.FillObjectFromDataReader(DataProvider.GetRDSCollectionById(collectionId));
+ var organization = OrganizationController.GetOrganization(collection.ItemId);
+
+ if (organization == null)
+ {
+ return result;
+ }
+
+ var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(organization.PackageId));
+
+ return rds.GetRdsUserSessions(collection.Name).ToList();
+ }
+
private static RdsServersPaged GetFreeRdsServersPagedInternal(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows)
{
RdsServersPaged result = new RdsServersPaged();
@@ -1105,6 +1131,44 @@ namespace WebsitePanel.EnterpriseServer
return result;
}
+ private static ResultObject LogOffRdsUserInternal(int itemId, string unifiedSessionId, string hostServer)
+ {
+ var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "LOG_OFF_RDS_USER");
+
+ try
+ {
+ Organization org = OrganizationController.GetOrganization(itemId);
+
+ if (org == null)
+ {
+ result.IsSuccess = false;
+ result.AddError("LOG_OFF_RDS_USER", new NullReferenceException("Organization not found"));
+
+ return result;
+ }
+
+ var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId));
+ rds.LogOffRdsUser(unifiedSessionId, hostServer);
+ }
+ catch (Exception ex)
+ {
+ result.AddError("REMOTE_DESKTOP_SERVICES_LOG_OFF_RDS_USER", ex);
+ }
+ finally
+ {
+ if (!result.IsSuccess)
+ {
+ TaskManager.CompleteResultTask(result);
+ }
+ else
+ {
+ TaskManager.CompleteResultTask();
+ }
+ }
+
+ return result;
+ }
+
private static ResultObject AddRemoteApplicationToCollectionInternal(int itemId, RdsCollection collection, RemoteApplication remoteApp)
{
var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "ADD_REMOTE_APP_TO_COLLECTION");
diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs
index 3aed999a..de7dfb0f 100644
--- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs
+++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs
@@ -271,5 +271,17 @@ namespace WebsitePanel.EnterpriseServer
{
return RemoteDesktopServicesController.SetApplicationUsers(itemId, collectionId, remoteApp, users);
}
+
+ [WebMethod]
+ public List GetRdsUserSessions(int collectionId)
+ {
+ return RemoteDesktopServicesController.GetRdsUserSessions(collectionId);
+ }
+
+ [WebMethod]
+ public ResultObject LogOffRdsUser(int itemId, string unifiedSessionId, string hostServer)
+ {
+ return RemoteDesktopServicesController.LogOffRdsUser(itemId, unifiedSessionId, hostServer);
+ }
}
}
diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs
index 343baa96..942d0ced 100644
--- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs
+++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs
@@ -66,5 +66,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
bool CheckRDSServerAvaliable(string hostname);
List GetServersExistingInCollections();
void EditRdsCollectionSettings(RdsCollection collection);
+ List GetRdsUserSessions(string collectionName);
+ void LogOffRdsUser(string unifiedSessionId, string hostServer);
}
}
diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsUserSession.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsUserSession.cs
new file mode 100644
index 00000000..8b03a51b
--- /dev/null
+++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsUserSession.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace WebsitePanel.Providers.RemoteDesktopServices
+{
+ public class RdsUserSession
+ {
+ public string CollectionName { get; set; }
+ public string UserName { get; set; }
+ public string UnifiedSessionId { get; set; }
+ public string SessionState { get; set; }
+ public string HostServer { get; set; }
+ }
+}
diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj
index e3d9ff2b..6e8b7bd8 100644
--- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj
+++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj
@@ -136,6 +136,7 @@
+
diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs
index 05a2dc37..508b691c 100644
--- a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs
+++ b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs
@@ -336,6 +336,50 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
}
}
+ public List GetRdsUserSessions(string collectionName)
+ {
+ Runspace runSpace = null;
+ var result = new List();
+
+ try
+ {
+ runSpace = OpenRunspace();
+ result = GetRdsUserSessionsInternal(collectionName, runSpace);
+ }
+ finally
+ {
+ CloseRunspace(runSpace);
+ }
+
+ return result;
+ }
+
+ public void LogOffRdsUser(string unifiedSessionId, string hostServer)
+ {
+ Runspace runSpace = null;
+
+ try
+ {
+ runSpace = OpenRunspace();
+ object[] errors;
+ Command cmd = new Command("Invoke-RDUserLogoff");
+ cmd.Parameters.Add("HostServer", hostServer);
+ cmd.Parameters.Add("UnifiedSessionID", unifiedSessionId);
+ cmd.Parameters.Add("Force", true);
+
+ ExecuteShellCommand(runSpace, cmd, false, out errors);
+
+ if (errors != null && errors.Length > 0)
+ {
+ throw new Exception(string.Join("r\\n\\", errors.Select(e => e.ToString()).ToArray()));
+ }
+ }
+ finally
+ {
+ CloseRunspace(runSpace);
+ }
+ }
+
public List GetServersExistingInCollections()
{
Runspace runSpace = null;
@@ -1676,6 +1720,35 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
return new List();
}
+ internal List GetRdsUserSessionsInternal(string collectionName, Runspace runSpace)
+ {
+ var result = new List();
+ var scripts = new List();
+ scripts.Add(string.Format("Get-RDUserSession -ConnectionBroker {0} - CollectionName {1} | ft CollectionName, Username, UnifiedSessionId, SessionState, HostServer", ConnectionBroker, collectionName));
+ object[] errors;
+ Command cmd = new Command("Get-RDUserSession");
+ cmd.Parameters.Add("CollectionName", collectionName);
+ cmd.Parameters.Add("ConnectionBroker", ConnectionBroker);
+ var userSessions = ExecuteShellCommand(runSpace, cmd, false, out errors);
+
+ //var userSessions = ExecuteShellCommand(runSpace, scripts, out errors);
+ var properties = typeof(RdsUserSession).GetProperties();
+
+ foreach(var userSession in userSessions)
+ {
+ var session = new RdsUserSession();
+
+ foreach(var prop in properties)
+ {
+ prop.SetValue(session, GetPSObjectProperty(userSession, prop.Name).ToString(), null);
+ }
+
+ result.Add(session);
+ }
+
+ return result;
+ }
+
#endregion
}
}
diff --git a/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs b/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs
index 772de6e9..3f06e32a 100644
--- a/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs
+++ b/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs
@@ -33,6 +33,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
private System.Threading.SendOrPostCallback EditRdsCollectionSettingsOperationCompleted;
+ private System.Threading.SendOrPostCallback GetRdsUserSessionsOperationCompleted;
+
private System.Threading.SendOrPostCallback AddRdsServersToDeploymentOperationCompleted;
private System.Threading.SendOrPostCallback GetCollectionOperationCompleted;
@@ -75,6 +77,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
private System.Threading.SendOrPostCallback GetServersExistingInCollectionsOperationCompleted;
+ private System.Threading.SendOrPostCallback LogOffRdsUserOperationCompleted;
+
///
public RemoteDesktopServices() {
this.Url = "http://localhost:9003/RemoteDesktopServices.asmx";
@@ -86,6 +90,9 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
///
public event EditRdsCollectionSettingsCompletedEventHandler EditRdsCollectionSettingsCompleted;
+ ///
+ public event GetRdsUserSessionsCompletedEventHandler GetRdsUserSessionsCompleted;
+
///
public event AddRdsServersToDeploymentCompletedEventHandler AddRdsServersToDeploymentCompleted;
@@ -149,6 +156,9 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
///
public event GetServersExistingInCollectionsCompletedEventHandler GetServersExistingInCollectionsCompleted;
+ ///
+ public event LogOffRdsUserCompletedEventHandler LogOffRdsUserCompleted;
+
///
[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)]
@@ -234,6 +244,48 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
}
}
+ ///
+ [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
+ [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetRdsUserSessions", 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 RdsUserSession[] GetRdsUserSessions(string collectionName) {
+ object[] results = this.Invoke("GetRdsUserSessions", new object[] {
+ collectionName});
+ return ((RdsUserSession[])(results[0]));
+ }
+
+ ///
+ public System.IAsyncResult BeginGetRdsUserSessions(string collectionName, System.AsyncCallback callback, object asyncState) {
+ return this.BeginInvoke("GetRdsUserSessions", new object[] {
+ collectionName}, callback, asyncState);
+ }
+
+ ///
+ public RdsUserSession[] EndGetRdsUserSessions(System.IAsyncResult asyncResult) {
+ object[] results = this.EndInvoke(asyncResult);
+ return ((RdsUserSession[])(results[0]));
+ }
+
+ ///
+ public void GetRdsUserSessionsAsync(string collectionName) {
+ this.GetRdsUserSessionsAsync(collectionName, null);
+ }
+
+ ///
+ public void GetRdsUserSessionsAsync(string collectionName, object userState) {
+ if ((this.GetRdsUserSessionsOperationCompleted == null)) {
+ this.GetRdsUserSessionsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRdsUserSessionsOperationCompleted);
+ }
+ this.InvokeAsync("GetRdsUserSessions", new object[] {
+ collectionName}, this.GetRdsUserSessionsOperationCompleted, userState);
+ }
+
+ private void OnGetRdsUserSessionsOperationCompleted(object arg) {
+ if ((this.GetRdsUserSessionsCompleted != null)) {
+ System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
+ this.GetRdsUserSessionsCompleted(this, new GetRdsUserSessionsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
+ }
+ }
+
///
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/AddRdsServersToDeployment", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
@@ -1157,6 +1209,49 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
}
}
+ ///
+ [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
+ [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/LogOffRdsUser", 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 LogOffRdsUser(string unifiedSessionId, string hostServer) {
+ this.Invoke("LogOffRdsUser", new object[] {
+ unifiedSessionId,
+ hostServer});
+ }
+
+ ///
+ public System.IAsyncResult BeginLogOffRdsUser(string unifiedSessionId, string hostServer, System.AsyncCallback callback, object asyncState) {
+ return this.BeginInvoke("LogOffRdsUser", new object[] {
+ unifiedSessionId,
+ hostServer}, callback, asyncState);
+ }
+
+ ///
+ public void EndLogOffRdsUser(System.IAsyncResult asyncResult) {
+ this.EndInvoke(asyncResult);
+ }
+
+ ///
+ public void LogOffRdsUserAsync(string unifiedSessionId, string hostServer) {
+ this.LogOffRdsUserAsync(unifiedSessionId, hostServer, null);
+ }
+
+ ///
+ public void LogOffRdsUserAsync(string unifiedSessionId, string hostServer, object userState) {
+ if ((this.LogOffRdsUserOperationCompleted == null)) {
+ this.LogOffRdsUserOperationCompleted = new System.Threading.SendOrPostCallback(this.OnLogOffRdsUserOperationCompleted);
+ }
+ this.InvokeAsync("LogOffRdsUser", new object[] {
+ unifiedSessionId,
+ hostServer}, this.LogOffRdsUserOperationCompleted, userState);
+ }
+
+ private void OnLogOffRdsUserOperationCompleted(object arg) {
+ if ((this.LogOffRdsUserCompleted != null)) {
+ System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
+ this.LogOffRdsUserCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
+ }
+ }
+
///
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
@@ -1193,6 +1288,32 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void EditRdsCollectionSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
+ public delegate void GetRdsUserSessionsCompletedEventHandler(object sender, GetRdsUserSessionsCompletedEventArgs e);
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ public partial class GetRdsUserSessionsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
+
+ private object[] results;
+
+ internal GetRdsUserSessionsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
+ base(exception, cancelled, userState) {
+ this.results = results;
+ }
+
+ ///
+ public RdsUserSession[] Result {
+ get {
+ this.RaiseExceptionIfNecessary();
+ return ((RdsUserSession[])(this.results[0]));
+ }
+ }
+ }
+
///
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void AddRdsServersToDeploymentCompletedEventHandler(object sender, AddRdsServersToDeploymentCompletedEventArgs e);
@@ -1628,4 +1749,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
}
}
}
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
+ public delegate void LogOffRdsUserCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
}
diff --git a/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs b/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs
index 1dd8b6e6..796a6448 100644
--- a/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs
+++ b/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs
@@ -92,6 +92,24 @@ namespace WebsitePanel.Server
}
}
+ [WebMethod, SoapHeader("settings")]
+ public List GetRdsUserSessions(string collectionName)
+ {
+ try
+ {
+ Log.WriteStart("'{0}' GetRdsUserSessions", ProviderSettings.ProviderName);
+ var result = RDSProvider.GetRdsUserSessions(collectionName);
+ Log.WriteEnd("'{0}' GetRdsUserSessions", ProviderSettings.ProviderName);
+
+ return result;
+ }
+ catch (Exception ex)
+ {
+ Log.WriteError(String.Format("'{0}' GetRdsUserSessions", ProviderSettings.ProviderName), ex);
+ throw;
+ }
+ }
+
[WebMethod, SoapHeader("settings")]
public bool AddRdsServersToDeployment(RdsServer[] servers)
{
@@ -443,5 +461,21 @@ namespace WebsitePanel.Server
throw;
}
}
+
+ [WebMethod, SoapHeader("settings")]
+ public void LogOffRdsUser(string unifiedSessionId, string hostServer)
+ {
+ try
+ {
+ Log.WriteStart("'{0}' LogOffRdsUser", ProviderSettings.ProviderName);
+ RDSProvider.LogOffRdsUser(unifiedSessionId, hostServer);
+ Log.WriteEnd("'{0}' LogOffRdsUser", ProviderSettings.ProviderName);
+ }
+ catch (Exception ex)
+ {
+ Log.WriteError(String.Format("'{0}' LogOffRdsUser", ProviderSettings.ProviderName), ex);
+ throw;
+ }
+ }
}
}
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config
index 29dde726..beadb444 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config
@@ -150,4 +150,5 @@
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config
index 885e8b53..80078941 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config
@@ -581,6 +581,7 @@
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx
index 3d851e29..9e50d93c 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx
@@ -5641,4 +5641,10 @@
RDS Collection settings not updated
+
+ RDS User logging off error
+
+
+ GEtting RDS User sessions error
+
\ No newline at end of file
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSUserSessions.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSUserSessions.ascx.resx
new file mode 100644
index 00000000..53c766e3
--- /dev/null
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSUserSessions.ascx.resx
@@ -0,0 +1,150 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Host Server
+
+
+ No user sessions.
+
+
+ Session State
+
+
+ User Name
+
+
+ Edit RDS Collection
+
+
+ RDS User Sessions
+
+
+ RDS User Sessions
+
+
+ if(!confirm('Are you sure you want to log off user?')) return false; else ShowProgressDialog('Logging off user...');
+
+
+ Log Off
+
+
+ Log Off
+
+
\ No newline at end of file
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx
new file mode 100644
index 00000000..cb81c5b5
--- /dev/null
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx
@@ -0,0 +1,74 @@
+<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDSUserSessions.ascx.cs" Inherits="WebsitePanel.Portal.RDS.RDSUserSessions" %>
+<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %>
+<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
+<%@ Register Src="UserControls/RDSCollectionTabs.ascx" TagName="CollectionTabs" TagPrefix="wsp" %>
+<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../UserControls/CollapsiblePanel.ascx" %>
+<%@ Register Src="../UserControls/ItemButtonPanel.ascx" TagName="ItemButtonPanel" TagPrefix="wsp" %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.cs
new file mode 100644
index 00000000..24873e88
--- /dev/null
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.cs
@@ -0,0 +1,81 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using WebsitePanel.Providers.RemoteDesktopServices;
+
+namespace WebsitePanel.Portal.RDS
+{
+ public partial class RDSUserSessions : WebsitePanelModuleBase
+ {
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ buttonPanel.ButtonSaveVisible = false;
+
+ if (!IsPostBack)
+ {
+ var collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID);
+ litCollectionName.Text = collection.Name;
+ BindGrid();
+ }
+ }
+
+ protected void gvRDSCollections_RowCommand(object sender, GridViewCommandEventArgs e)
+ {
+ if (e.CommandName == "LogOff")
+ {
+ var arguments = e.CommandArgument.ToString().Split(';');
+ string unifiedSessionId = arguments[0];
+ string hostServer = arguments[1];
+
+ try
+ {
+ ES.Services.RDS.LogOffRdsUser(PanelRequest.ItemID, unifiedSessionId, hostServer);
+ BindGrid();
+
+ }
+ catch (Exception ex)
+ {
+ ShowErrorMessage("REMOTE_DESKTOP_SERVICES_LOG_OFF_USER", ex);
+ }
+ }
+ }
+
+ protected void btnSave_Click(object sender, EventArgs e)
+ {
+ if (!Page.IsValid)
+ {
+ return;
+ }
+ }
+
+ protected void btnSaveExit_Click(object sender, EventArgs e)
+ {
+ if (!Page.IsValid)
+ {
+ return;
+ }
+
+ Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_collections", "SpaceID=" + PanelSecurity.PackageId));
+ }
+
+ private void BindGrid()
+ {
+ var userSessions = new List();
+
+ try
+ {
+ userSessions = ES.Services.RDS.GetRdsUserSessions(PanelRequest.CollectionID).ToList();
+ }
+ catch(Exception ex)
+ {
+ ShowErrorMessage("REMOTE_DESKTOP_SERVICES_USER_SESSIONS", ex);
+ }
+
+ gvRDSUserSessions.DataSource = userSessions;
+ gvRDSUserSessions.DataBind();
+ }
+ }
+}
\ No newline at end of file
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.designer.cs
new file mode 100644
index 00000000..9f276bcc
--- /dev/null
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.designer.cs
@@ -0,0 +1,105 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace WebsitePanel.Portal.RDS {
+
+
+ public partial class RDSUserSessions {
+
+ ///
+ /// asyncTasks control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks;
+
+ ///
+ /// imgEditRDSCollection control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Image imgEditRDSCollection;
+
+ ///
+ /// locTitle control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Localize locTitle;
+
+ ///
+ /// litCollectionName control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Literal litCollectionName;
+
+ ///
+ /// tabs control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::WebsitePanel.Portal.RDS.UserControls.RdsServerTabs tabs;
+
+ ///
+ /// messageBox control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
+
+ ///
+ /// secRdsUserSessions control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::WebsitePanel.Portal.CollapsiblePanel secRdsUserSessions;
+
+ ///
+ /// panelRdsUserSessions control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Panel panelRdsUserSessions;
+
+ ///
+ /// gvRDSUserSessions control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.GridView gvRDSUserSessions;
+
+ ///
+ /// buttonPanel control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::WebsitePanel.Portal.ItemButtonPanel buttonPanel;
+ }
+}
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionTabs.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionTabs.ascx.resx
index 288b1145..afb4730a 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionTabs.ascx.resx
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionTabs.ascx.resx
@@ -129,4 +129,7 @@
Settings
+
+ User Sessions
+
\ No newline at end of file
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx
index 06dc8446..35aa06a7 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx
@@ -5,13 +5,13 @@
-
+
<%# Eval("Name") %>
-
+
<%# Eval("Name") %>
@@ -19,4 +19,12 @@
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx.cs
index 7c99c275..00fab605 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx.cs
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx.cs
@@ -24,6 +24,7 @@ namespace WebsitePanel.Portal.RDS.UserControls
tabsList.Add(CreateTab("rds_edit_collection_settings", "Tab.Settings"));
tabsList.Add(CreateTab("rds_collection_edit_apps", "Tab.RdsApplications"));
tabsList.Add(CreateTab("rds_collection_edit_users", "Tab.RdsUsers"));
+ tabsList.Add(CreateTab("rds_collection_user_sessions", "Tab.UserSessions"));
int idx = 0;
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj
index 0156e3bd..046875ad 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj
@@ -330,6 +330,13 @@
RDSCollections.ascx
+
+ RDSUserSessions.ascx
+ ASPXCodeBehind
+
+
+ RDSUserSessions.ascx
+
RDSCollectionApps.ascx
ASPXCodeBehind
@@ -4365,6 +4372,7 @@
+
@@ -4386,6 +4394,7 @@
Designer
+
ResXFileCodeGenerator
DomainLookupView.ascx.Designer.cs
@@ -5702,7 +5711,9 @@
Designer
-
+
+ Designer
+