merge commit

This commit is contained in:
robvde 2015-04-02 21:31:42 +08:00
commit bfa2d0cd08
31 changed files with 927 additions and 87 deletions

View file

@ -9460,3 +9460,5 @@ BEGIN
END
GO
UPDATE [dbo].[Quotas] SET GroupID = 45 WHERE QuotaName = 'EnterpriseStorage.DriveMaps'

View file

@ -20,8 +20,8 @@ namespace WebsitePanel.EnterpriseServer {
using System.Diagnostics;
using WebsitePanel.Providers.RemoteDesktopServices;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.EnterpriseServer.Base.RDS;
using WebsitePanel.Providers.HostedSolution;
/// <remarks/>
@ -137,6 +137,8 @@ namespace WebsitePanel.EnterpriseServer {
private System.Threading.SendOrPostCallback UpdateRdsServerSettingsOperationCompleted;
private System.Threading.SendOrPostCallback ShadowSessionOperationCompleted;
/// <remarks/>
public esRemoteDesktopServices() {
this.Url = "http://localhost:9002/esRemoteDesktopServices.asmx";
@ -301,6 +303,9 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/>
public event UpdateRdsServerSettingsCompletedEventHandler UpdateRdsServerSettingsCompleted;
/// <remarks/>
public event ShadowSessionCompletedEventHandler ShadowSessionCompleted;
/// <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) {
@ -2671,6 +2676,53 @@ namespace WebsitePanel.EnterpriseServer {
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/ShadowSession", 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 ShadowSession(int itemId, string sessionId, bool control) {
object[] results = this.Invoke("ShadowSession", new object[] {
itemId,
sessionId,
control});
return ((ResultObject)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginShadowSession(int itemId, string sessionId, bool control, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("ShadowSession", new object[] {
itemId,
sessionId,
control}, callback, asyncState);
}
/// <remarks/>
public ResultObject EndShadowSession(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((ResultObject)(results[0]));
}
/// <remarks/>
public void ShadowSessionAsync(int itemId, string sessionId, bool control) {
this.ShadowSessionAsync(itemId, sessionId, control, null);
}
/// <remarks/>
public void ShadowSessionAsync(int itemId, string sessionId, bool control, object userState) {
if ((this.ShadowSessionOperationCompleted == null)) {
this.ShadowSessionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnShadowSessionOperationCompleted);
}
this.InvokeAsync("ShadowSession", new object[] {
itemId,
sessionId,
control}, this.ShadowSessionOperationCompleted, userState);
}
private void OnShadowSessionOperationCompleted(object arg) {
if ((this.ShadowSessionCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.ShadowSessionCompleted(this, new ShadowSessionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
@ -4054,4 +4106,30 @@ namespace WebsitePanel.EnterpriseServer {
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void ShadowSessionCompletedEventHandler(object sender, ShadowSessionCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class ShadowSessionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal ShadowSessionCompletedEventArgs(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

@ -586,7 +586,7 @@ namespace WebsitePanel.EnterpriseServer
var userGroups = OrganizationController.GetSecurityGroupsByMember(itemId, accountId);
foreach (var folder in es.GetFolders(org.OrganizationId, webDavSettings))
foreach (var folder in es.GetFoldersWithoutFrsm(org.OrganizationId, webDavSettings))
{
var permissions = ConvertToESPermission(itemId,folder.Rules);

View file

@ -331,6 +331,49 @@ namespace WebsitePanel.EnterpriseServer
return UpdateRdsServerSettingsInternal(serverId, settingsName, settings);
}
public static ResultObject ShadowSession(int itemId, string sessionId, bool control)
{
return ShadowSessionInternal(itemId, sessionId, control);
}
private static ResultObject ShadowSessionInternal(int itemId, string sessionId, bool control)
{
var result = TaskManager.StartResultTask<ResultObject>("REMOTE_DESKTOP_SERVICES", "SHADOW_RDS_SESSION");
try
{
Organization org = OrganizationController.GetOrganization(itemId);
if (org == null)
{
result.IsSuccess = false;
result.AddError("SHADOW_RDS_SESSION", new NullReferenceException("Organization not found"));
return result;
}
var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId));
rds.ShadowSession(sessionId, control);
}
catch (Exception ex)
{
result.AddError("REMOTE_DESKTOP_SERVICES_SHADOW_RDS_SESSION", ex);
}
finally
{
if (!result.IsSuccess)
{
TaskManager.CompleteResultTask(result);
}
else
{
TaskManager.CompleteResultTask();
}
}
return result;
}
private static RdsServerSettings GetRdsServerSettingsInternal(int serverId, string settingsName)
{
IDataReader reader = DataProvider.GetRdsServerSettings(serverId, settingsName);
@ -363,7 +406,8 @@ namespace WebsitePanel.EnterpriseServer
{
var collection = ObjectUtils.FillObjectFromDataReader<RdsCollection>(DataProvider.GetRDSCollectionById(serverId));
var rds = GetRemoteDesktopServices(GetRdsServiceId(collection.ItemId));
rds.ApplyGPO(collection.Name, settings);
Organization org = OrganizationController.GetOrganization(collection.ItemId);
rds.ApplyGPO(org.OrganizationId, collection.Name, settings);
XmlDocument doc = new XmlDocument();
XmlElement nodeProps = doc.CreateElement("properties");
@ -748,7 +792,7 @@ namespace WebsitePanel.EnterpriseServer
};
rds.CreateCollection(org.OrganizationId, collection);
rds.ApplyGPO(collection.Name, GetDefaultGpoSettings());
rds.ApplyGPO(org.OrganizationId, collection.Name, GetDefaultGpoSettings());
collection.Id = DataProvider.AddRDSCollection(itemId, collection.Name, collection.Description, collection.DisplayName);
collection.Settings.RdsCollectionId = collection.Id;

View file

@ -612,6 +612,7 @@ namespace WebsitePanel.EnterpriseServer
#region Setup External network
TaskManager.Write("VPS_CREATE_SETUP_EXTERNAL_NETWORK");
TaskManager.IndicatorCurrent = -1; // Some providers (for example HyperV2012R2) could not provide progress
try
{
@ -644,6 +645,7 @@ namespace WebsitePanel.EnterpriseServer
#region Setup Management network
TaskManager.Write("VPS_CREATE_SETUP_MANAGEMENT_NETWORK");
TaskManager.IndicatorCurrent = -1; // Some providers (for example HyperV2012R2) could not provide progress
try
{
@ -704,6 +706,7 @@ namespace WebsitePanel.EnterpriseServer
#region Setup Private network
TaskManager.Write("VPS_CREATE_SETUP_PRIVATE_NETWORK");
TaskManager.IndicatorCurrent = -1; // Some providers (for example HyperV2012R2) could not provide progress
try
{
@ -759,6 +762,7 @@ namespace WebsitePanel.EnterpriseServer
TaskManager.Write("VPS_CREATE_CONVERT_VHD");
TaskManager.Write("VPS_CREATE_CONVERT_SOURCE_VHD", vm.OperatingSystemTemplatePath);
TaskManager.Write("VPS_CREATE_CONVERT_DEST_VHD", vm.VirtualHardDrivePath);
TaskManager.IndicatorCurrent = -1; // Some providers (for example HyperV2012R2) could not provide progress
try
{
// convert VHD
@ -817,6 +821,7 @@ namespace WebsitePanel.EnterpriseServer
if (vm.HddSize > hddSizeGB)
{
TaskManager.Write("VPS_CREATE_EXPAND_VHD");
TaskManager.IndicatorCurrent = -1; // Some providers (for example HyperV2012R2) could not provide progress
// expand VHD
try
@ -958,6 +963,7 @@ namespace WebsitePanel.EnterpriseServer
TaskManager.Write("VPS_CREATE_CPU_CORES", vm.CpuCores.ToString());
TaskManager.Write("VPS_CREATE_RAM_SIZE", vm.RamSize.ToString());
TaskManager.Write("VPS_CREATE_CREATE_VM");
TaskManager.IndicatorCurrent = -1; // Some providers (for example HyperV2012R2) could not provide progress
// create virtual machine
try
{
@ -1031,6 +1037,7 @@ namespace WebsitePanel.EnterpriseServer
#region Start VPS
TaskManager.Write("VPS_CREATE_START_VPS");
TaskManager.IndicatorCurrent = -1; // Some providers (for example HyperV2012R2) could not provide progress
try
{

View file

@ -380,5 +380,11 @@ namespace WebsitePanel.EnterpriseServer
{
return RemoteDesktopServicesController.UpdateRdsServerSettings(serverId, settingsName, settings);
}
[WebMethod]
public ResultObject ShadowSession(int itemId, string sessionId, bool control)
{
return RemoteDesktopServicesController.ShadowSession(itemId, sessionId, control);
}
}
}

View file

@ -39,6 +39,7 @@ namespace WebsitePanel.Providers.EnterpriseStorage
public interface IEnterpriseStorage
{
SystemFile[] GetFolders(string organizationId, WebDavSetting[] settings);
SystemFile[] GetFoldersWithoutFrsm(string organizationId, WebDavSetting[] settings);
SystemFile GetFolder(string organizationId, string folderName, WebDavSetting setting);
void CreateFolder(string organizationId, string folder, WebDavSetting setting);
SystemFile RenameFolder(string organizationId, string originalFolder, string newFolder, WebDavSetting setting);

View file

@ -81,6 +81,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
void RemoveRdsServerFromTenantOU(string hostName, string organizationId);
void InstallCertificate(byte[] certificate, string password, List<string> hostNames);
void MoveSessionHostToRdsOU(string hostName);
void ApplyGPO(string collectionName, RdsServerSettings serverSettings);
void ApplyGPO(string organizationId, string collectionName, RdsServerSettings serverSettings);
void ShadowSession(string sessionId, bool control);
}
}

View file

@ -39,6 +39,12 @@ namespace WebsitePanel.EnterpriseServer.Base.RDS
public const string SCREEN_SAVER_DISABLED_ADMINISTRATORS = "ScreenSaverDisabledAdministrators";
public const string SCREEN_SAVER_DISABLED_USERS = "ScreenSaverDisabledUsers";
public const string DRIVE_SPACE_THRESHOLD_VALUE = "DriveSpaceThresholdValue";
public const string RDS_VIEW_WITHOUT_PERMISSION = "RDSViewWithoutPermission";
public const string RDS_VIEW_WITHOUT_PERMISSION_ADMINISTRATORS = "RDSViewWithoutPermissionAdministrators";
public const string RDS_VIEW_WITHOUT_PERMISSION_Users = "RDSViewWithoutPermissionUsers";
public const string RDS_CONTROL_WITHOUT_PERMISSION = "RDSControlWithoutPermission";
public const string RDS_CONTROL_WITHOUT_PERMISSION_ADMINISTRATORS = "RDSControlWithoutPermissionAdministrators";
public const string RDS_CONTROL_WITHOUT_PERMISSION_Users = "RDSControlWithoutPermissionUsers";
public string SettingsName { get; set; }
public int ServerId { get; set; }
@ -58,5 +64,21 @@ namespace WebsitePanel.EnterpriseServer.Base.RDS
settings = value;
}
}
public static List<KeyValuePair<string, string>> ScreenSaverTimeOuts
{
get
{
return new List<KeyValuePair<string, string>> {
new KeyValuePair<string, string>("", "None"),
new KeyValuePair<string, string>("10", "10"),
new KeyValuePair<string, string>("20", "20"),
new KeyValuePair<string, string>("30", "30"),
new KeyValuePair<string, string>("40", "40"),
new KeyValuePair<string, string>("50", "50"),
new KeyValuePair<string, string>("60", "60")
};
}
}
}
}

View file

@ -122,6 +122,49 @@ namespace WebsitePanel.Providers.EnterpriseStorage
return (SystemFile[]) items.ToArray(typeof (SystemFile));
}
public SystemFile[] GetFoldersWithoutFrsm(string organizationId, WebDavSetting[] settings)
{
ArrayList items = new ArrayList();
var webDavSettings = GetWebDavSettings(settings);
foreach (var setting in webDavSettings)
{
string rootPath = string.Format("{0}:\\{1}\\{2}", setting.LocationDrive, setting.HomeFolder,
organizationId);
if (Directory.Exists(rootPath))
{
DirectoryInfo root = new DirectoryInfo(rootPath);
IWebDav webdav = new Web.WebDav(setting);
// get directories
DirectoryInfo[] dirs = root.GetDirectories();
foreach (DirectoryInfo dir in dirs)
{
SystemFile folder = new SystemFile();
folder.Name = dir.Name;
folder.FullName = dir.FullName;
folder.IsDirectory = true;
if (folder.Size == -1)
{
folder.Size = FileUtils.BytesToMb(FileUtils.CalculateFolderSize(dir.FullName));
}
folder.Url = string.Format("https://{0}/{1}/{2}", setting.Domain, organizationId, dir.Name);
folder.Rules = webdav.GetFolderWebDavRules(organizationId, dir.Name);
items.Add(folder);
}
}
}
return (SystemFile[])items.ToArray(typeof(SystemFile));
}
public SystemFile GetFolder(string organizationId, string folderName, WebDavSetting setting)
{
var webDavSetting = GetWebDavSetting(setting);

View file

@ -1792,7 +1792,7 @@ namespace WebsitePanel.Providers.HostedSolution
uidAttr.Value = Guid.NewGuid().ToString("B");
bypassErrorsAttr.Value = (1).ToString();
actionPropAttr.Value = "R";
actionPropAttr.Value = "C";
thisDrivePropAttr.Value = "NOCHANGE";
allDrivesPropAttr.Value = "NOCHANGE";
userNamePropAttr.Value = string.Empty;

View file

@ -2034,8 +2034,9 @@ Public Class MailEnable
End If
If [String].IsNullOrEmpty(version) = False Then
Dim split As String() = version.Split(New [Char]() {"."c})
Return split(0).Equals("1") Or split(0).Equals("2") Or split(0).Equals("3") Or split(0).Equals("4") Or split(0).Equals("5") Or split(0).Equals("6") Or split(0).Equals("7")
'all versions of MailEnable will be compatible with this, so we are just checking to see if there is a version number
'future versions aim to retain compatibility
Return True
Else
Return False
End If

View file

@ -93,6 +93,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
private const string DisableTaskManagerGpoValueName = "DisableTaskMgr";
private const string HideCDriveGpoKey = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer";
private const string HideCDriveGpoValueName = "NoDrives";
private const string RDSSessionGpoKey = @"HKCU\Software\Policies\Microsoft\Windows NT\Terminal Services";
private const string RDSSessionGpoValueName = "Shadow";
#endregion
@ -371,6 +373,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
CreatePolicy(runSpace, organizationId, string.Format("{0}-administrators", collection.Name), new DirectoryEntry(GetGroupPath(organizationId, collection.Name, GetLocalAdminsGroupName(collection.Name))), collection.Name);
CreatePolicy(runSpace, organizationId, string.Format("{0}-users", collection.Name), new DirectoryEntry(GetUsersGroupPath(organizationId, collection.Name)), collection.Name);
CreateHelpDeskPolicy(runSpace, new DirectoryEntry(GetHelpDeskGroupPath(RDSHelpDeskGroup)), organizationId, collection.Name);
}
finally
{
@ -516,6 +519,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
DeleteGpo(runSpace, string.Format("{0}-administrators", collectionName));
DeleteGpo(runSpace, string.Format("{0}-users", collectionName));
DeleteHelpDeskPolicy(runSpace, collectionName);
var capPolicyName = GetPolicyName(organizationId, collectionName, RdsPolicyTypes.RdCap);
var rapPolicyName = GetPolicyName(organizationId, collectionName, RdsPolicyTypes.RdRap);
@ -1116,7 +1120,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
#region GPO
public void ApplyGPO(string collectionName, RdsServerSettings serverSettings)
public void ApplyGPO(string organizationId, string collectionName, RdsServerSettings serverSettings)
{
string administratorsGpo = string.Format("{0}-administrators", collectionName);
string usersGpo = string.Format("{0}-users", collectionName);
@ -1126,6 +1130,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
{
runspace = OpenRunspace();
CreateHelpDeskPolicy(runspace, new DirectoryEntry(GetHelpDeskGroupPath(RDSHelpDeskGroup)), organizationId, collectionName);
RemoveRegistryValue(runspace, ScreenSaverGpoKey, administratorsGpo);
RemoveRegistryValue(runspace, ScreenSaverGpoKey, usersGpo);
RemoveRegistryValue(runspace, RemoveRestartGpoKey, administratorsGpo);
@ -1133,28 +1138,30 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
RemoveRegistryValue(runspace, DisableTaskManagerGpoKey, administratorsGpo);
RemoveRegistryValue(runspace, DisableTaskManagerGpoKey, usersGpo);
var setting = serverSettings.Settings.First(s => s.PropertyName.Equals(RdsServerSettings.SCREEN_SAVER_DISABLED));
var setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.SCREEN_SAVER_DISABLED));
SetRegistryValue(setting, runspace, ScreenSaverGpoKey, administratorsGpo, usersGpo, ScreenSaverValueName, "0", "string");
setting = serverSettings.Settings.First(s => s.PropertyName.Equals(RdsServerSettings.REMOVE_SHUTDOWN_RESTART));
setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.REMOVE_SHUTDOWN_RESTART));
SetRegistryValue(setting, runspace, RemoveRestartGpoKey, administratorsGpo, usersGpo, RemoveRestartGpoValueName, "1", "DWord");
setting = serverSettings.Settings.First(s => s.PropertyName.Equals(RdsServerSettings.REMOVE_RUN_COMMAND));
setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.REMOVE_RUN_COMMAND));
SetRegistryValue(setting, runspace, RemoveRunGpoKey, administratorsGpo, usersGpo, RemoveRunGpoValueName, "1", "DWord");
setting = serverSettings.Settings.First(s => s.PropertyName.Equals(RdsServerSettings.DISABLE_TASK_MANAGER));
setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.DISABLE_TASK_MANAGER));
SetRegistryValue(setting, runspace, DisableTaskManagerGpoKey, administratorsGpo, usersGpo, DisableTaskManagerGpoValueName, "1", "DWord");
setting = serverSettings.Settings.First(s => s.PropertyName.Equals(RdsServerSettings.HIDE_C_DRIVE));
setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.HIDE_C_DRIVE));
SetRegistryValue(setting, runspace, HideCDriveGpoKey, administratorsGpo, usersGpo, HideCDriveGpoValueName, "4", "DWord");
setting = serverSettings.Settings.First(s => s.PropertyName.Equals(RdsServerSettings.LOCK_SCREEN_TIMEOUT));
setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.LOCK_SCREEN_TIMEOUT));
double result;
if (!string.IsNullOrEmpty(setting.PropertyValue) && double.TryParse(setting.PropertyValue, out result))
if (setting != null && !string.IsNullOrEmpty(setting.PropertyValue) && double.TryParse(setting.PropertyValue, out result))
{
SetRegistryValue(setting, runspace, ScreenSaverTimeoutGpoKey, administratorsGpo, usersGpo, ScreenSaverTimeoutValueName, setting.PropertyValue, "string");
}
SetRdsSessionHostPermissions(runspace, serverSettings, usersGpo, administratorsGpo);
}
finally
{
@ -1162,6 +1169,43 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
}
}
private void SetRdsSessionHostPermissions(Runspace runspace, RdsServerSettings settings, string usersGpo, string administratorsGpo)
{
var viewSetting = settings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION));
var controlSetting = settings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION));
if (viewSetting == null || controlSetting == null)
{
return;
}
if (controlSetting.ApplyUsers)
{
SetRegistryValue(runspace, RDSSessionGpoKey, usersGpo, "2", RDSSessionGpoValueName, "DWord");
}
else if (viewSetting.ApplyUsers)
{
SetRegistryValue(runspace, RDSSessionGpoKey, usersGpo, "4", RDSSessionGpoValueName, "DWord");
}
else
{
SetRegistryValue(runspace, RDSSessionGpoKey, usersGpo, "3", RDSSessionGpoValueName, "DWord");
}
if (controlSetting.ApplyAdministrators)
{
SetRegistryValue(runspace, RDSSessionGpoKey, administratorsGpo, "2", RDSSessionGpoValueName, "DWord");
}
else if (viewSetting.ApplyAdministrators)
{
SetRegistryValue(runspace, RDSSessionGpoKey, administratorsGpo, "4", RDSSessionGpoValueName, "DWord");
}
else
{
SetRegistryValue(runspace, RDSSessionGpoKey, administratorsGpo, "3", RDSSessionGpoValueName, "DWord");
}
}
private void RemoveRegistryValue(Runspace runspace, string key, string gpoName)
{
Command cmd = new Command("Remove-GPRegistryValue");
@ -1173,6 +1217,11 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
private void SetRegistryValue(RdsServerSetting setting, Runspace runspace, string key, string administratorsGpo, string usersGpo, string valueName, string value, string type)
{
if (setting == null)
{
return;
}
if (setting.ApplyAdministrators)
{
SetRegistryValue(runspace, key, administratorsGpo, value, valueName, type);
@ -1196,6 +1245,19 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
Collection<PSObject> result = ExecuteRemoteShellCommand(runspace, PrimaryDomainController, cmd);
}
private void CreateHelpDeskPolicy(Runspace runspace, DirectoryEntry entry, string organizationId, string collectionName)
{
string gpoName = string.Format("{0}-HelpDesk", collectionName);
string gpoId = GetPolicyId(runspace, gpoName);
if (string.IsNullOrEmpty(gpoId))
{
gpoId = CreateAndLinkPolicy(runspace, gpoName, organizationId, collectionName);
SetPolicyPermissions(runspace, gpoName, entry);
SetRegistryValue(runspace, RDSSessionGpoKey, gpoName, "2", RDSSessionGpoValueName, "DWord");
}
}
private string CreatePolicy(Runspace runspace, string organizationId, string gpoName, DirectoryEntry entry, string collectionName)
{
string gpoId = GetPolicyId(runspace, gpoName);
@ -1209,6 +1271,12 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
return gpoId;
}
private void DeleteHelpDeskPolicy(Runspace runspace, string collectionName)
{
string gpoName = string.Format("{0}-HelpDesk", collectionName);
DeleteGpo(runspace, gpoName);
}
private void DeleteGpo(Runspace runspace, string gpoName)
{
Command cmd = new Command("Remove-GPO");
@ -1235,7 +1303,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
try
{
var entry = new DirectoryEntry(GetCollectionOUPath(organizationId, string.Format("{0}-OU", collectionName)));
var entry = new DirectoryEntry(GetOrganizationPath(organizationId));
var distinguishedName = string.Format("\"{0}\"", ActiveDirectoryUtils.GetADObjectProperty(entry, "DistinguishedName"));
Command cmd = new Command("New-GPO");
@ -1294,6 +1362,32 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
#endregion
#region Shadow Session
public void ShadowSession(string sessionId, bool control)
{
Runspace runspace = null;
try
{
runspace = OpenRunspace();
var scripts = new List<string>
{
string.Format("mstsc /Shadow:{0}{1}", sessionId, control ? " /Control" : "")
};
object[] errors = null;
ExecuteShellCommand(runspace, scripts, out errors);
}
finally
{
CloseRunspace(runspace);
}
}
#endregion
#region RDS Help Desk
private string GetHelpDeskGroupPath(string groupName)

View file

@ -11,10 +11,6 @@
//
// This source code was auto-generated by wsdl, Version=2.0.50727.3038.
//
using WebsitePanel.Providers.OS;
using WebsitePanel.Providers.Web;
namespace WebsitePanel.Providers.EnterpriseStorage {
using System.Xml.Serialization;
using System.Web.Services;
@ -22,6 +18,8 @@ namespace WebsitePanel.Providers.EnterpriseStorage {
using System.Web.Services.Protocols;
using System;
using System.Diagnostics;
using WebsitePanel.Providers.OS;
using WebsitePanel.Providers.Web;
/// <remarks/>
@ -36,6 +34,8 @@ namespace WebsitePanel.Providers.EnterpriseStorage {
private System.Threading.SendOrPostCallback GetFoldersOperationCompleted;
private System.Threading.SendOrPostCallback GetFoldersWithoutFrsmOperationCompleted;
private System.Threading.SendOrPostCallback GetFolderOperationCompleted;
private System.Threading.SendOrPostCallback CreateFolderOperationCompleted;
@ -60,6 +60,9 @@ namespace WebsitePanel.Providers.EnterpriseStorage {
/// <remarks/>
public event GetFoldersCompletedEventHandler GetFoldersCompleted;
/// <remarks/>
public event GetFoldersWithoutFrsmCompletedEventHandler GetFoldersWithoutFrsmCompleted;
/// <remarks/>
public event GetFolderCompletedEventHandler GetFolderCompleted;
@ -129,6 +132,51 @@ namespace WebsitePanel.Providers.EnterpriseStorage {
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetFoldersWithoutFrsm", 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 SystemFile[] GetFoldersWithoutFrsm(string organizationId, WebDavSetting[] settings) {
object[] results = this.Invoke("GetFoldersWithoutFrsm", new object[] {
organizationId,
settings});
return ((SystemFile[])(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetFoldersWithoutFrsm(string organizationId, WebDavSetting[] settings, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetFoldersWithoutFrsm", new object[] {
organizationId,
settings}, callback, asyncState);
}
/// <remarks/>
public SystemFile[] EndGetFoldersWithoutFrsm(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((SystemFile[])(results[0]));
}
/// <remarks/>
public void GetFoldersWithoutFrsmAsync(string organizationId, WebDavSetting[] settings) {
this.GetFoldersWithoutFrsmAsync(organizationId, settings, null);
}
/// <remarks/>
public void GetFoldersWithoutFrsmAsync(string organizationId, WebDavSetting[] settings, object userState) {
if ((this.GetFoldersWithoutFrsmOperationCompleted == null)) {
this.GetFoldersWithoutFrsmOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetFoldersWithoutFrsmOperationCompleted);
}
this.InvokeAsync("GetFoldersWithoutFrsm", new object[] {
organizationId,
settings}, this.GetFoldersWithoutFrsmOperationCompleted, userState);
}
private void OnGetFoldersWithoutFrsmOperationCompleted(object arg) {
if ((this.GetFoldersWithoutFrsmCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetFoldersWithoutFrsmCompleted(this, new GetFoldersWithoutFrsmCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetFolder", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
@ -544,6 +592,32 @@ namespace WebsitePanel.Providers.EnterpriseStorage {
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetFoldersWithoutFrsmCompletedEventHandler(object sender, GetFoldersWithoutFrsmCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetFoldersWithoutFrsmCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetFoldersWithoutFrsmCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public SystemFile[] Result {
get {
this.RaiseExceptionIfNecessary();
return ((SystemFile[])(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetFolderCompletedEventHandler(object sender, GetFolderCompletedEventArgs e);

View file

@ -104,6 +104,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
private System.Threading.SendOrPostCallback ApplyGPOOperationCompleted;
private System.Threading.SendOrPostCallback ShadowSessionOperationCompleted;
/// <remarks/>
public RemoteDesktopServices() {
this.Url = "http://localhost:9003/RemoteDesktopServices.asmx";
@ -220,6 +222,9 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
/// <remarks/>
public event ApplyGPOCompletedEventHandler ApplyGPOCompleted;
/// <remarks/>
public event ShadowSessionCompletedEventHandler ShadowSessionCompleted;
/// <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)]
@ -1791,15 +1796,17 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/ApplyGPO", 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 ApplyGPO(string collectionName, RdsServerSettings serverSettings) {
public void ApplyGPO(string organizationId, string collectionName, RdsServerSettings serverSettings) {
this.Invoke("ApplyGPO", new object[] {
organizationId,
collectionName,
serverSettings});
}
/// <remarks/>
public System.IAsyncResult BeginApplyGPO(string collectionName, RdsServerSettings serverSettings, System.AsyncCallback callback, object asyncState) {
public System.IAsyncResult BeginApplyGPO(string organizationId, string collectionName, RdsServerSettings serverSettings, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("ApplyGPO", new object[] {
organizationId,
collectionName,
serverSettings}, callback, asyncState);
}
@ -1810,16 +1817,17 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
}
/// <remarks/>
public void ApplyGPOAsync(string collectionName, RdsServerSettings serverSettings) {
this.ApplyGPOAsync(collectionName, serverSettings, null);
public void ApplyGPOAsync(string organizationId, string collectionName, RdsServerSettings serverSettings) {
this.ApplyGPOAsync(organizationId, collectionName, serverSettings, null);
}
/// <remarks/>
public void ApplyGPOAsync(string collectionName, RdsServerSettings serverSettings, object userState) {
public void ApplyGPOAsync(string organizationId, string collectionName, RdsServerSettings serverSettings, object userState) {
if ((this.ApplyGPOOperationCompleted == null)) {
this.ApplyGPOOperationCompleted = new System.Threading.SendOrPostCallback(this.OnApplyGPOOperationCompleted);
}
this.InvokeAsync("ApplyGPO", new object[] {
organizationId,
collectionName,
serverSettings}, this.ApplyGPOOperationCompleted, userState);
}
@ -1831,6 +1839,49 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/ShadowSession", 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 ShadowSession(string sessionId, bool control) {
this.Invoke("ShadowSession", new object[] {
sessionId,
control});
}
/// <remarks/>
public System.IAsyncResult BeginShadowSession(string sessionId, bool control, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("ShadowSession", new object[] {
sessionId,
control}, callback, asyncState);
}
/// <remarks/>
public void EndShadowSession(System.IAsyncResult asyncResult) {
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void ShadowSessionAsync(string sessionId, bool control) {
this.ShadowSessionAsync(sessionId, control, null);
}
/// <remarks/>
public void ShadowSessionAsync(string sessionId, bool control, object userState) {
if ((this.ShadowSessionOperationCompleted == null)) {
this.ShadowSessionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnShadowSessionOperationCompleted);
}
this.InvokeAsync("ShadowSession", new object[] {
sessionId,
control}, this.ShadowSessionOperationCompleted, userState);
}
private void OnShadowSessionOperationCompleted(object arg) {
if ((this.ShadowSessionCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.ShadowSessionCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
@ -2468,4 +2519,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void ApplyGPOCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void ShadowSessionCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
}

View file

@ -75,6 +75,23 @@ namespace WebsitePanel.Server
}
}
[WebMethod, SoapHeader("settings")]
public SystemFile[] GetFoldersWithoutFrsm(string organizationId, WebDavSetting[] settings)
{
try
{
Log.WriteStart("'{0}' GetFolders", ProviderSettings.ProviderName);
SystemFile[] result = EnterpriseStorageProvider.GetFoldersWithoutFrsm(organizationId, settings);
Log.WriteEnd("'{0}' GetFolders", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetFolders", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public SystemFile GetFolder(string organizationId, string folder, WebDavSetting setting)
{

View file

@ -665,12 +665,12 @@ namespace WebsitePanel.Server
}
[WebMethod, SoapHeader("settings")]
public void ApplyGPO(string collectionName, RdsServerSettings serverSettings)
public void ApplyGPO(string organizationId, string collectionName, RdsServerSettings serverSettings)
{
try
{
Log.WriteStart("'{0}' ApplyGPO", ProviderSettings.ProviderName);
RDSProvider.ApplyGPO(collectionName, serverSettings);
RDSProvider.ApplyGPO(organizationId, collectionName, serverSettings);
Log.WriteEnd("'{0}' ApplyGPO", ProviderSettings.ProviderName);
}
catch (Exception ex)
@ -679,5 +679,21 @@ namespace WebsitePanel.Server
throw;
}
}
[WebMethod, SoapHeader("settings")]
public void ShadowSession(string sessionId, bool control)
{
try
{
Log.WriteStart("'{0}' ShadowSession", ProviderSettings.ProviderName);
RDSProvider.ShadowSession(sessionId, control);
Log.WriteEnd("'{0}' ShadowSession", ProviderSettings.ProviderName);
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' ShadowSession", ProviderSettings.ProviderName), ex);
throw;
}
}
}
}

View file

@ -5702,6 +5702,12 @@
<data name="ERROR.REMOTE_DESKTOP_SERVICES_LOG_OFF_USER" xml:space="preserve">
<value>RDS User logging off error</value>
</data>
<data name="ERROR.REMOTE_DESKTOP_SERVICES_VIEW_SESSION" xml:space="preserve">
<value>View session error</value>
</data>
<data name="ERROR.REMOTE_DESKTOP_SERVICES_CONTROL_SESSION" xml:space="preserve">
<value>Control session error</value>
</data>
<data name="ERROR.REMOTE_DESKTOP_SERVICES_USER_SESSIONS" xml:space="preserve">
<value>Getting RDS User sessions error</value>
</data>

View file

@ -123,6 +123,12 @@
<data name="cbUsers.Text" xml:space="preserve">
<value>Users</value>
</data>
<data name="secChangeDesktop.Text" xml:space="preserve">
<value>Changing Desktop Disabled</value>
</data>
<data name="secControlSession.Text" xml:space="preserve">
<value>Control RDS Session without Users's Permission</value>
</data>
<data name="secDriveSpace.Text" xml:space="preserve">
<value>Drive Space Threshold</value>
</data>
@ -145,9 +151,9 @@
<value>Disable Task Manager</value>
</data>
<data name="secTimeout.Text" xml:space="preserve">
<value>Lock Screen Timeout</value>
<value>Lock Screen Timeout (sec.)</value>
</data>
<data name="sekChangeDesktop.Text" xml:space="preserve">
<value>Changing Desktop Disabled</value>
<data name="secViewSession.Text" xml:space="preserve">
<value>View RDS Session without Users's Permission</value>
</data>
</root>

View file

@ -337,7 +337,7 @@ namespace WebsitePanel.Portal
{
if (((CheckBox)gvr.FindControl(checkboxName)).Checked)
{
string userId = gridView.DataKeys[gvr.DataItemIndex].Value.ToString();
string userId = gridView.DataKeys[gvr.DataItemIndex % gridView.PageSize].Value.ToString();
userIds.Add((T)Convert.ChangeType(userId, typeof(T)));
}
}

View file

@ -123,6 +123,12 @@
<data name="cbUsers.Text" xml:space="preserve">
<value>Users</value>
</data>
<data name="secChangeDesktop.Text" xml:space="preserve">
<value>Changing Desktop Disabled</value>
</data>
<data name="secControlSession.Text" xml:space="preserve">
<value>Control RDS Session without Users's Permission</value>
</data>
<data name="secDriveSpace.Text" xml:space="preserve">
<value>Drive Space Threshold</value>
</data>
@ -147,7 +153,7 @@
<data name="secTimeout.Text" xml:space="preserve">
<value>Lock Screen Timeout</value>
</data>
<data name="sekChangeDesktop.Text" xml:space="preserve">
<value>Changing Desktop Disabled</value>
<data name="secViewSession.Text" xml:space="preserve">
<value>View RDS Session without Users's Permission</value>
</data>
</root>

View file

@ -150,4 +150,16 @@
<data name="btnRefresh.Text" xml:space="preserve">
<value>Refresh</value>
</data>
<data name="cmdControlSession.Text" xml:space="preserve">
<value>Control</value>
</data>
<data name="cmdControlSession.ToolTip" xml:space="preserve">
<value>Control Session</value>
</data>
<data name="cmdViewSession.Text" xml:space="preserve">
<value>View</value>
</data>
<data name="cmdViewSession.ToolTip" xml:space="preserve">
<value>View Session</value>
</data>
</root>

View file

@ -29,7 +29,7 @@
<table>
<tr>
<td colspan="2">
<asp:TextBox ID="txtTimeout" runat="server" CssClass="TextBox200" ></asp:TextBox>
<asp:DropDownList ID="ddTimeout" runat="server" CssClass="NormalTextBox"/>
</td>
</tr>
<tr>
@ -146,7 +146,45 @@
<table>
<tr>
<td colspan="2">
<asp:TextBox ID="txtThreshold" runat="server" CssClass="TextBox200" ></asp:TextBox>
<asp:DropDownList ID="ddTreshold" runat="server" CssClass="NormalTextBox">
<asp:ListItem Value="" Text="None" />
<asp:ListItem Value="5" Text="5%" />
<asp:ListItem Value="10" Text="10%" />
<asp:ListItem Value="15" Text="15%" />
<asp:ListItem Value="20" Text="20%" />
<asp:ListItem Value="25" Text="25%" />
<asp:ListItem Value="30" Text="30%" />
<asp:ListItem Value="35" Text="35%" />
<asp:ListItem Value="40" Text="40%" />
</asp:DropDownList>
</td>
</tr>
</table>
<br />
</asp:Panel>
<wsp:CollapsiblePanel id="secViewSession" runat="server" TargetControlID="viewSessionPanel" meta:resourcekey="secViewSession" Text="View RDS Session without Users's Permission"/>
<asp:Panel ID="viewSessionPanel" runat="server" Height="0" style="overflow:hidden;">
<table>
<tr>
<td>
<asp:CheckBox runat="server" Text="Users" ID="cbViewSessionUsers" meta:resourcekey="cbUsers" Checked="false" />
</td>
<td>
<asp:CheckBox runat="server" Text="Administrators" meta:resourcekey="cbAdministrators" ID="cbViewSessionAdministrators" Checked="false" />
</td>
</tr>
</table>
<br />
</asp:Panel>
<wsp:CollapsiblePanel id="secControlSession" runat="server" TargetControlID="controlSessionPanel" meta:resourcekey="secControlSession" Text="Control RDS Session without Users's Permission"/>
<asp:Panel ID="controlSessionPanel" runat="server" Height="0" style="overflow:hidden;">
<table>
<tr>
<td>
<asp:CheckBox runat="server" Text="Users" ID="cbControlSessionUsers" meta:resourcekey="cbUsers" Checked="false" />
</td>
<td>
<asp:CheckBox runat="server" Text="Administrators" meta:resourcekey="cbAdministrators" ID="cbControlSessionAdministrators" Checked="false" />
</td>
</tr>
</table>

View file

@ -15,6 +15,12 @@ namespace WebsitePanel.Portal.RDS
{
if (!IsPostBack)
{
var timeouts = RdsServerSettings.ScreenSaverTimeOuts;
ddTimeout.DataSource = timeouts;
ddTimeout.DataTextField = "Value";
ddTimeout.DataValueField = "Key";
ddTimeout.DataBind();
var collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID);
litCollectionName.Text = collection.DisplayName;
BindSettings();
@ -39,45 +45,97 @@ namespace WebsitePanel.Portal.RDS
private void BindSettings(RdsServerSettings settings)
{
var setting = GetServerSetting(settings, RdsServerSettings.LOCK_SCREEN_TIMEOUT);
txtTimeout.Text = setting.PropertyValue;
if (setting != null)
{
ddTimeout.SelectedValue = setting.PropertyValue;
cbTimeoutAdministrators.Checked = setting.ApplyAdministrators;
cbTimeoutUsers.Checked = setting.ApplyUsers;
}
setting = GetServerSetting(settings, RdsServerSettings.REMOVE_RUN_COMMAND);
if (setting != null)
{
cbRunCommandAdministrators.Checked = setting.ApplyAdministrators;
cbRunCommandUsers.Checked = setting.ApplyUsers;
}
setting = GetServerSetting(settings, RdsServerSettings.REMOVE_POWERSHELL_COMMAND);
if (setting != null)
{
cbPowershellAdministrators.Checked = setting.ApplyAdministrators;
cbPowershellUsers.Checked = setting.ApplyUsers;
}
setting = GetServerSetting(settings, RdsServerSettings.HIDE_C_DRIVE);
if (setting != null)
{
cbHideCDriveAdministrators.Checked = setting.ApplyAdministrators;
cbHideCDriveUsers.Checked = setting.ApplyUsers;
}
setting = GetServerSetting(settings, RdsServerSettings.REMOVE_SHUTDOWN_RESTART);
if (setting != null)
{
cbShutdownAdministrators.Checked = setting.ApplyAdministrators;
cbShutdownUsers.Checked = setting.ApplyUsers;
}
setting = GetServerSetting(settings, RdsServerSettings.DISABLE_TASK_MANAGER);
if (setting != null)
{
cbTaskManagerAdministrators.Checked = setting.ApplyAdministrators;
cbTaskManagerUsers.Checked = setting.ApplyUsers;
}
setting = GetServerSetting(settings, RdsServerSettings.CHANGE_DESKTOP_DISABLED);
if (setting != null)
{
cbDesktopAdministrators.Checked = setting.ApplyAdministrators;
cbDesktopUsers.Checked = setting.ApplyUsers;
}
setting = GetServerSetting(settings, RdsServerSettings.SCREEN_SAVER_DISABLED);
if (setting != null)
{
cbScreenSaverAdministrators.Checked = setting.ApplyAdministrators;
cbViewSessionUsers.Checked = setting.ApplyUsers;
}
setting = GetServerSetting(settings, RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION);
if (setting != null)
{
cbViewSessionAdministrators.Checked = setting.ApplyAdministrators;
cbScreenSaverUsers.Checked = setting.ApplyUsers;
}
setting = GetServerSetting(settings, RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION);
if (setting != null)
{
cbControlSessionAdministrators.Checked = setting.ApplyAdministrators;
cbControlSessionUsers.Checked = setting.ApplyUsers;
}
setting = GetServerSetting(settings, RdsServerSettings.DRIVE_SPACE_THRESHOLD);
txtThreshold.Text = setting.PropertyValue;
if (setting != null)
{
ddTreshold.SelectedValue = setting.PropertyValue;
}
}
private RdsServerSetting GetServerSetting(RdsServerSettings settings, string propertyName)
{
return settings.Settings.First(s => s.PropertyName.Equals(propertyName));
return settings.Settings.FirstOrDefault(s => s.PropertyName.Equals(propertyName));
}
private RdsServerSettings GetSettings()
@ -87,7 +145,7 @@ namespace WebsitePanel.Portal.RDS
settings.Settings.Add(new RdsServerSetting
{
PropertyName = RdsServerSettings.LOCK_SCREEN_TIMEOUT,
PropertyValue = txtTimeout.Text,
PropertyValue = ddTimeout.SelectedValue,
ApplyAdministrators = cbTimeoutAdministrators.Checked,
ApplyUsers = cbTimeoutUsers.Checked
});
@ -151,17 +209,33 @@ namespace WebsitePanel.Portal.RDS
settings.Settings.Add(new RdsServerSetting
{
PropertyName = RdsServerSettings.DRIVE_SPACE_THRESHOLD,
PropertyValue = txtThreshold.Text,
PropertyValue = ddTreshold.SelectedValue,
ApplyAdministrators = true,
ApplyUsers = true
});
settings.Settings.Add(new RdsServerSetting
{
PropertyName = RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION,
PropertyValue = "",
ApplyAdministrators = cbViewSessionAdministrators.Checked,
ApplyUsers = cbViewSessionUsers.Checked
});
settings.Settings.Add(new RdsServerSetting
{
PropertyName = RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION,
PropertyValue = "",
ApplyAdministrators = cbControlSessionAdministrators.Checked,
ApplyUsers = cbControlSessionUsers.Checked
});
return settings;
}
private void BindDefaultSettings(UserSettings settings)
{
txtTimeout.Text = settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE];
ddTimeout.SelectedValue = settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE];
cbTimeoutAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_ADMINISTRATORS]);
cbTimeoutUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_USERS]);
@ -186,7 +260,12 @@ namespace WebsitePanel.Portal.RDS
cbScreenSaverAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.SCREEN_SAVER_DISABLED_ADMINISTRATORS]);
cbScreenSaverUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.SCREEN_SAVER_DISABLED_USERS]);
txtThreshold.Text = settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE];
cbViewSessionAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_ADMINISTRATORS]);
cbViewSessionUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_Users]);
cbControlSessionAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_ADMINISTRATORS]);
cbControlSessionUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_Users]);
ddTreshold.SelectedValue = settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE];
}
private bool SaveServerSettings()

View file

@ -85,13 +85,13 @@ namespace WebsitePanel.Portal.RDS {
protected global::System.Web.UI.WebControls.Panel timeoutPanel;
/// <summary>
/// txtTimeout control.
/// ddTimeout 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 txtTimeout;
protected global::System.Web.UI.WebControls.DropDownList ddTimeout;
/// <summary>
/// cbTimeoutUsers control.
@ -382,13 +382,85 @@ namespace WebsitePanel.Portal.RDS {
protected global::System.Web.UI.WebControls.Panel driveSpacePanel;
/// <summary>
/// txtThreshold control.
/// ddTreshold 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 txtThreshold;
protected global::System.Web.UI.WebControls.DropDownList ddTreshold;
/// <summary>
/// secViewSession control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secViewSession;
/// <summary>
/// viewSessionPanel 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 viewSessionPanel;
/// <summary>
/// cbViewSessionUsers 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 cbViewSessionUsers;
/// <summary>
/// cbViewSessionAdministrators 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 cbViewSessionAdministrators;
/// <summary>
/// secControlSession control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secControlSession;
/// <summary>
/// controlSessionPanel 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 controlSessionPanel;
/// <summary>
/// cbControlSessionUsers 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 cbControlSessionUsers;
/// <summary>
/// cbControlSessionAdministrators 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 cbControlSessionAdministrators;
/// <summary>
/// buttonPanel control.

View file

@ -40,7 +40,7 @@
OnRowCommand="gvRDSCollections_RowCommand" AllowPaging="True" AllowSorting="True">
<Columns>
<asp:TemplateField meta:resourcekey="gvUserName" HeaderText="gvUserName">
<ItemStyle Width="30%" Wrap="false"/>
<ItemStyle Width="25%" 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") %>'/>
@ -48,17 +48,29 @@
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvHostServer" HeaderText="gvHostServer">
<ItemStyle Width="30%" Wrap="false"/>
<ItemStyle Width="25%" Wrap="false"/>
<ItemTemplate>
<asp:Literal ID="litHostServer" runat="server" Text='<%# Eval("HostServer") %>'/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvSessionState" HeaderText="gvSessionState">
<ItemStyle Width="30%" Wrap="false"/>
<ItemStyle Width="25%" Wrap="false"/>
<ItemTemplate>
<asp:Literal ID="litSessionState" runat="server" Text='<%# Eval("SessionState") %>'/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkViewSession" runat="server" Text="View" CommandName="View" CommandArgument='<%# Eval("UnifiedSessionId") %>'
meta:resourcekey="cmdViewSession"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkControlSession" runat="server" Text="Control" CommandName="Control" CommandArgument='<%# Eval("UnifiedSessionId") %>'
meta:resourcekey="cmdControlSession"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkLogOff" runat="server" Text="Log Off" CommandName="LogOff" CommandArgument='<%# Eval("UnifiedSessionId") + ";" + Eval("HostServer") %>'

View file

@ -44,6 +44,28 @@ namespace WebsitePanel.Portal.RDS
ShowErrorMessage("REMOTE_DESKTOP_SERVICES_LOG_OFF_USER", ex);
}
}
else if (e.CommandName == "View")
{
try
{
ES.Services.RDS.ShadowSession(PanelRequest.ItemID, e.CommandArgument.ToString(), false);
}
catch (Exception ex)
{
ShowErrorMessage("REMOTE_DESKTOP_SERVICES_VIEW_SESSION", ex);
}
}
else if (e.CommandName == "Control")
{
try
{
ES.Services.RDS.ShadowSession(PanelRequest.ItemID, e.CommandArgument.ToString(), true);
}
catch (Exception ex)
{
ShowErrorMessage("REMOTE_DESKTOP_SERVICES_CONTROL_SESSION", ex);
}
}
}
protected void btnSave_Click(object sender, EventArgs e)

View file

@ -6,7 +6,7 @@
<table>
<tr>
<td colspan="2">
<asp:TextBox ID="txtTimeout" runat="server" CssClass="TextBox200" ></asp:TextBox>
<asp:DropDownList ID="ddTimeout" runat="server" CssClass="NormalTextBox"/>
</td>
</tr>
<tr>
@ -123,7 +123,45 @@
<table>
<tr>
<td colspan="2">
<asp:TextBox ID="txtThreshold" runat="server" CssClass="TextBox200" ></asp:TextBox>
<asp:DropDownList ID="ddTreshold" runat="server" CssClass="NormalTextBox">
<asp:ListItem Value="" Text="None" />
<asp:ListItem Value="5" Text="5%" />
<asp:ListItem Value="10" Text="10%" />
<asp:ListItem Value="15" Text="15%" />
<asp:ListItem Value="20" Text="20%" />
<asp:ListItem Value="25" Text="25%" />
<asp:ListItem Value="30" Text="30%" />
<asp:ListItem Value="35" Text="35%" />
<asp:ListItem Value="40" Text="40%" />
</asp:DropDownList>
</td>
</tr>
</table>
<br />
</asp:Panel>
<wsp:CollapsiblePanel id="secViewSession" runat="server" TargetControlID="viewSessionPanel" meta:resourcekey="secViewSession" Text="View RDS Session without Users's Permission"/>
<asp:Panel ID="viewSessionPanel" runat="server" Height="0" style="overflow:hidden;">
<table>
<tr>
<td>
<asp:CheckBox runat="server" Text="Users" ID="cbViewSessionUsers" meta:resourcekey="cbUsers" Checked="false" />
</td>
<td>
<asp:CheckBox runat="server" Text="Administrators" meta:resourcekey="cbAdministrators" ID="cbViewSessionAdministrators" Checked="false" />
</td>
</tr>
</table>
<br />
</asp:Panel>
<wsp:CollapsiblePanel id="secControlSession" runat="server" TargetControlID="controlSessionPanel" meta:resourcekey="secControlSession" Text="Control RDS Session without Users's Permission"/>
<asp:Panel ID="controlSessionPanel" runat="server" Height="0" style="overflow:hidden;">
<table>
<tr>
<td>
<asp:CheckBox runat="server" Text="Users" ID="cbControlSessionUsers" meta:resourcekey="cbUsers" Checked="false" />
</td>
<td>
<asp:CheckBox runat="server" Text="Administrators" meta:resourcekey="cbAdministrators" ID="cbControlSessionAdministrators" Checked="false" />
</td>
</tr>
</table>

View file

@ -13,7 +13,13 @@ namespace WebsitePanel.Portal
{
public void BindSettings(UserSettings settings)
{
txtTimeout.Text = settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE];
var timeouts = RdsServerSettings.ScreenSaverTimeOuts;
ddTimeout.DataSource = timeouts;
ddTimeout.DataTextField = "Value";
ddTimeout.DataValueField = "Key";
ddTimeout.DataBind();
ddTimeout.SelectedValue = settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE];
cbTimeoutAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_ADMINISTRATORS]);
cbTimeoutUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_USERS]);
@ -38,12 +44,17 @@ namespace WebsitePanel.Portal
cbScreenSaverAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.SCREEN_SAVER_DISABLED_ADMINISTRATORS]);
cbScreenSaverUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.SCREEN_SAVER_DISABLED_USERS]);
txtThreshold.Text = settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE];
cbViewSessionAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_ADMINISTRATORS]);
cbViewSessionUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_Users]);
cbControlSessionAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_ADMINISTRATORS]);
cbControlSessionUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_Users]);
ddTreshold.SelectedValue = settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE];
}
public void SaveSettings(UserSettings settings)
{
settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE] = txtTimeout.Text;
settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE] = ddTimeout.SelectedValue;
settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_ADMINISTRATORS] = cbTimeoutAdministrators.Checked.ToString();
settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_USERS] = cbTimeoutUsers.Checked.ToString();
settings[RdsServerSettings.REMOVE_RUN_COMMAND_ADMINISTRATORS] = cbRunCommandAdministrators.Checked.ToString();
@ -60,7 +71,7 @@ namespace WebsitePanel.Portal
settings[RdsServerSettings.CHANGE_DESKTOP_DISABLED_USERS] = cbDesktopUsers.Checked.ToString();
settings[RdsServerSettings.SCREEN_SAVER_DISABLED_ADMINISTRATORS] = cbScreenSaverAdministrators.Checked.ToString();
settings[RdsServerSettings.SCREEN_SAVER_DISABLED_USERS] = cbScreenSaverUsers.Checked.ToString();
settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE] = txtThreshold.Text;
settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE] = ddTreshold.SelectedValue;
}
}
}

View file

@ -31,13 +31,13 @@ namespace WebsitePanel.Portal {
protected global::System.Web.UI.WebControls.Panel timeoutPanel;
/// <summary>
/// txtTimeout control.
/// ddTimeout 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 txtTimeout;
protected global::System.Web.UI.WebControls.DropDownList ddTimeout;
/// <summary>
/// cbTimeoutUsers control.
@ -328,12 +328,84 @@ namespace WebsitePanel.Portal {
protected global::System.Web.UI.WebControls.Panel driveSpacePanel;
/// <summary>
/// txtThreshold control.
/// ddTreshold 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 txtThreshold;
protected global::System.Web.UI.WebControls.DropDownList ddTreshold;
/// <summary>
/// secViewSession control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secViewSession;
/// <summary>
/// viewSessionPanel 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 viewSessionPanel;
/// <summary>
/// cbViewSessionUsers 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 cbViewSessionUsers;
/// <summary>
/// cbViewSessionAdministrators 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 cbViewSessionAdministrators;
/// <summary>
/// secControlSession control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secControlSession;
/// <summary>
/// controlSessionPanel 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 controlSessionPanel;
/// <summary>
/// cbControlSessionUsers 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 cbControlSessionUsers;
/// <summary>
/// cbControlSessionAdministrators 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 cbControlSessionAdministrators;
}
}

View file

@ -214,6 +214,10 @@ namespace WebsitePanel.Portal.VPS.UserControls
// gauge
gauge.Visible = false;
if (e.Item.ItemIndex == task.GetLogs().Count - 1)
{
if (task.IndicatorCurrent == -1)
litRecord.Text += "...";
else
{
gauge.Visible = true;
gauge.Total = task.IndicatorMaximum;
@ -222,4 +226,5 @@ namespace WebsitePanel.Portal.VPS.UserControls
}
}
}
}
}