RDS GPO changes

This commit is contained in:
vfedosevich 2015-03-31 01:26:36 -07:00
parent e7a2b84af2
commit 7af8432f4b
8 changed files with 74 additions and 26 deletions

View file

@ -38,7 +38,7 @@ namespace WebsitePanel.EnterpriseServer.Base.RDS
public const string CHANGE_DESKTOP_DISABLED_USERS = "ChangingDesktopDisabledUsers";
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 DRIVE_SPACE_THRESHOLD_VALUE = "DriveSpaceThresholdValue";
public string SettingsName { get; set; }
public int ServerId { get; set; }
@ -58,5 +58,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

@ -145,7 +145,7 @@
<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>

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>
@ -145,8 +145,18 @@
<asp:Panel ID="driveSpacePanel" runat="server" Height="0" style="overflow:hidden;">
<table>
<tr>
<td colspan="2">
<asp:TextBox ID="txtThreshold" runat="server" CssClass="TextBox200" ></asp:TextBox>
<td colspan="2">
<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>

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,7 +45,7 @@ namespace WebsitePanel.Portal.RDS
private void BindSettings(RdsServerSettings settings)
{
var setting = GetServerSetting(settings, RdsServerSettings.LOCK_SCREEN_TIMEOUT);
txtTimeout.Text = setting.PropertyValue;
ddTimeout.SelectedValue = setting.PropertyValue;
cbTimeoutAdministrators.Checked = setting.ApplyAdministrators;
cbTimeoutUsers.Checked = setting.ApplyUsers;
@ -72,7 +78,7 @@ namespace WebsitePanel.Portal.RDS
cbScreenSaverUsers.Checked = setting.ApplyUsers;
setting = GetServerSetting(settings, RdsServerSettings.DRIVE_SPACE_THRESHOLD);
txtThreshold.Text = setting.PropertyValue;
ddTreshold.SelectedValue = setting.PropertyValue;
}
private RdsServerSetting GetServerSetting(RdsServerSettings settings, string propertyName)
@ -87,7 +93,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,7 +157,7 @@ namespace WebsitePanel.Portal.RDS
settings.Settings.Add(new RdsServerSetting
{
PropertyName = RdsServerSettings.DRIVE_SPACE_THRESHOLD,
PropertyValue = txtThreshold.Text,
PropertyValue = ddTreshold.SelectedValue,
ApplyAdministrators = true,
ApplyUsers = true
});
@ -161,7 +167,7 @@ namespace WebsitePanel.Portal.RDS
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 +192,7 @@ 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];
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,13 @@ 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>
/// buttonPanel control.

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>
@ -122,8 +122,18 @@
<asp:Panel ID="driveSpacePanel" runat="server" Height="0" style="overflow:hidden;">
<table>
<tr>
<td colspan="2">
<asp:TextBox ID="txtThreshold" runat="server" CssClass="TextBox200" ></asp:TextBox>
<td colspan="2">
<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>

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,12 @@ 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];
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 +66,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,12 @@ 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;
}
}