SEBWIN-581: Implemented new registry setting to suppress find printer option in system print dialog.
This commit is contained in:
parent
32be808415
commit
d2d93db9f0
14 changed files with 866 additions and 724 deletions
|
@ -23,6 +23,9 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping
|
|||
case Keys.Service.EnableEaseOfAccessOptions:
|
||||
MapEnableEaseOfAccessOptions(settings, value);
|
||||
break;
|
||||
case Keys.Service.EnableFindPrinter:
|
||||
MapEnableFindPrinter(settings, value);
|
||||
break;
|
||||
case Keys.Service.EnableNetworkOptions:
|
||||
MapEnableNetworkOptions(settings, value);
|
||||
break;
|
||||
|
@ -81,6 +84,14 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping
|
|||
}
|
||||
}
|
||||
|
||||
private void MapEnableFindPrinter(AppSettings settings, object value)
|
||||
{
|
||||
if (value is bool enable)
|
||||
{
|
||||
settings.Service.DisableFindPrinter = !enable;
|
||||
}
|
||||
}
|
||||
|
||||
private void MapEnableNetworkOptions(AppSettings settings, object value)
|
||||
{
|
||||
if (value is bool enable)
|
||||
|
|
|
@ -265,6 +265,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
|
|||
|
||||
settings.Service.DisableChromeNotifications = true;
|
||||
settings.Service.DisableEaseOfAccessOptions = true;
|
||||
settings.Service.DisableFindPrinter = true;
|
||||
settings.Service.DisableNetworkOptions = true;
|
||||
settings.Service.DisablePasswordChange = true;
|
||||
settings.Service.DisablePowerOptions = true;
|
||||
|
|
|
@ -308,6 +308,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
|
|||
{
|
||||
internal const string EnableChromeNotifications = "enableChromeNotifications";
|
||||
internal const string EnableEaseOfAccessOptions = "insideSebEnableEaseOfAccess";
|
||||
internal const string EnableFindPrinter = "enableFindPrinter";
|
||||
internal const string EnableNetworkOptions = "insideSebEnableNetworkConnectionSelector";
|
||||
internal const string EnablePasswordChange = "insideSebEnableChangeAPassword";
|
||||
internal const string EnablePowerOptions = "insideSebEnableShutDown";
|
||||
|
|
|
@ -36,6 +36,11 @@ namespace SafeExamBrowser.Lockdown.Contracts
|
|||
/// </summary>
|
||||
IFeatureConfiguration CreateEaseOfAccessConfiguration(Guid groupId);
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IFeatureConfiguration"/> to control the find printer option in the print dialog of Windows.
|
||||
/// </summary>
|
||||
IFeatureConfiguration CreateFindPrinterConfiguration(Guid groupId, string sid, string userName);
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IFeatureConfiguration"/> to control the option to lock the computer via the security screen.
|
||||
/// </summary>
|
||||
|
|
|
@ -9,16 +9,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SafeExamBrowser.Lockdown.Contracts;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
using SafeExamBrowser.Lockdown.FeatureConfigurations.RegistryConfigurations.MachineHive;
|
||||
using SafeExamBrowser.Lockdown.FeatureConfigurations.RegistryConfigurations.UserHive;
|
||||
using SafeExamBrowser.Lockdown.FeatureConfigurations.ServiceConfigurations;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Lockdown
|
||||
{
|
||||
public class FeatureConfigurationFactory : IFeatureConfigurationFactory
|
||||
{
|
||||
private IModuleLogger logger;
|
||||
private readonly IModuleLogger logger;
|
||||
|
||||
public FeatureConfigurationFactory(IModuleLogger logger)
|
||||
{
|
||||
|
@ -32,6 +32,7 @@ namespace SafeExamBrowser.Lockdown
|
|||
CreateChangePasswordConfiguration(groupId, sid, userName),
|
||||
CreateChromeNotificationConfiguration(groupId, sid, userName),
|
||||
CreateEaseOfAccessConfiguration(groupId),
|
||||
CreateFindPrinterConfiguration(groupId, sid, userName),
|
||||
CreateLockWorkstationConfiguration(groupId, sid, userName),
|
||||
CreateMachinePowerOptionsConfiguration(groupId),
|
||||
CreateNetworkOptionsConfiguration(groupId),
|
||||
|
@ -60,6 +61,11 @@ namespace SafeExamBrowser.Lockdown
|
|||
return new EaseOfAccessConfiguration(groupId, logger.CloneFor(nameof(EaseOfAccessConfiguration)));
|
||||
}
|
||||
|
||||
public IFeatureConfiguration CreateFindPrinterConfiguration(Guid groupId, string sid, string userName)
|
||||
{
|
||||
return new FindPrinterConfiguration(groupId, logger.CloneFor(nameof(FindPrinterConfiguration)), sid, userName);
|
||||
}
|
||||
|
||||
public IFeatureConfiguration CreateLockWorkstationConfiguration(Guid groupId, string sid, string userName)
|
||||
{
|
||||
return new LockWorkstationConfiguration(groupId, logger.CloneFor(nameof(LockWorkstationConfiguration)), sid, userName);
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) 2022 ETH Zürich, Educational Development and Technology (LET)
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Lockdown.FeatureConfigurations.RegistryConfigurations.UserHive
|
||||
{
|
||||
[Serializable]
|
||||
internal class FindPrinterConfiguration : UserHiveConfiguration
|
||||
{
|
||||
protected override IEnumerable<RegistryConfigurationItem> Items => new[]
|
||||
{
|
||||
new RegistryConfigurationItem($@"HKEY_USERS\{SID}\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoAddPrinter", 1, 0)
|
||||
};
|
||||
|
||||
public FindPrinterConfiguration(Guid groupId, ILogger logger, string sid, string userName) : base(groupId, logger, sid, userName)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool Reset()
|
||||
{
|
||||
return DeleteConfiguration();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -65,6 +65,7 @@
|
|||
<Compile Include="FeatureConfigurations\FeatureConfiguration.cs" />
|
||||
<Compile Include="FeatureConfigurations\RegistryConfigurations\MachineHive\MachineHiveConfiguration.cs" />
|
||||
<Compile Include="FeatureConfigurations\RegistryConfigurations\RegistryConfiguration.cs" />
|
||||
<Compile Include="FeatureConfigurations\RegistryConfigurations\UserHive\FindPrinterConfiguration.cs" />
|
||||
<Compile Include="FeatureConfigurations\RegistryConfigurations\UserHive\UserPowerOptionsConfiguration.cs" />
|
||||
<Compile Include="FeatureConfigurations\RegistryConfigurations\UserHive\UserHiveConfiguration.cs" />
|
||||
<Compile Include="FeatureConfigurations\RegistryConfigurations\UserHive\TaskManagerConfiguration.cs" />
|
||||
|
|
|
@ -114,6 +114,7 @@ namespace SafeExamBrowser.Service.UnitTests.Operations
|
|||
factory.Verify(f => f.CreateChangePasswordConfiguration(It.Is<Guid>(id => id == groupId), It.IsAny<string>(), It.IsAny<string>()), Times.Once);
|
||||
factory.Verify(f => f.CreateChromeNotificationConfiguration(It.Is<Guid>(id => id == groupId), It.IsAny<string>(), It.IsAny<string>()), Times.Once);
|
||||
factory.Verify(f => f.CreateEaseOfAccessConfiguration(It.Is<Guid>(id => id == groupId)), Times.Once);
|
||||
factory.Verify(f => f.CreateFindPrinterConfiguration(It.Is<Guid>(id => id == groupId), It.IsAny<string>(), It.IsAny<string>()), Times.Once);
|
||||
factory.Verify(f => f.CreateLockWorkstationConfiguration(It.Is<Guid>(id => id == groupId), It.IsAny<string>(), It.IsAny<string>()), Times.Once);
|
||||
factory.Verify(f => f.CreateMachinePowerOptionsConfiguration(It.Is<Guid>(id => id == groupId)), Times.Once);
|
||||
factory.Verify(f => f.CreateNetworkOptionsConfiguration(It.Is<Guid>(id => id == groupId)), Times.Once);
|
||||
|
|
|
@ -16,10 +16,11 @@ namespace SafeExamBrowser.Service.Operations
|
|||
{
|
||||
internal class LockdownOperation : SessionOperation
|
||||
{
|
||||
private IFeatureConfigurationBackup backup;
|
||||
private IFeatureConfigurationFactory factory;
|
||||
private IFeatureConfigurationMonitor monitor;
|
||||
private ILogger logger;
|
||||
private readonly IFeatureConfigurationBackup backup;
|
||||
private readonly IFeatureConfigurationFactory factory;
|
||||
private readonly IFeatureConfigurationMonitor monitor;
|
||||
private readonly ILogger logger;
|
||||
|
||||
private Guid groupId;
|
||||
|
||||
public LockdownOperation(
|
||||
|
@ -47,6 +48,7 @@ namespace SafeExamBrowser.Service.Operations
|
|||
(factory.CreateChangePasswordConfiguration(groupId, sid, userName), Context.Configuration.Settings.Service.DisablePasswordChange),
|
||||
(factory.CreateChromeNotificationConfiguration(groupId, sid, userName), Context.Configuration.Settings.Service.DisableChromeNotifications),
|
||||
(factory.CreateEaseOfAccessConfiguration(groupId), Context.Configuration.Settings.Service.DisableEaseOfAccessOptions),
|
||||
(factory.CreateFindPrinterConfiguration(groupId, sid, userName), Context.Configuration.Settings.Service.DisableFindPrinter),
|
||||
(factory.CreateLockWorkstationConfiguration(groupId, sid, userName), Context.Configuration.Settings.Service.DisableUserLock),
|
||||
(factory.CreateMachinePowerOptionsConfiguration(groupId), Context.Configuration.Settings.Service.DisablePowerOptions),
|
||||
(factory.CreateNetworkOptionsConfiguration(groupId), Context.Configuration.Settings.Service.DisableNetworkOptions),
|
||||
|
|
|
@ -23,6 +23,11 @@ namespace SafeExamBrowser.Settings.Service
|
|||
/// </summary>
|
||||
public bool DisableEaseOfAccessOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the user can access the find printer option in the print dialog of Windows.
|
||||
/// </summary>
|
||||
public bool DisableFindPrinter { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the user can access the network options on the security screen.
|
||||
/// </summary>
|
||||
|
|
|
@ -399,6 +399,7 @@ namespace SebWindowsConfig
|
|||
public const String KeyInsideSebEnableVmWareClientShade = "insideSebEnableVmWareClientShade";
|
||||
public const String KeyInsideSebEnableNetworkConnectionSelector = "insideSebEnableNetworkConnectionSelector";
|
||||
public const String KeySetVmwareConfiguration = "setVmwareConfiguration";
|
||||
public const String KeyEnableFindPrinter = "enableFindPrinter";
|
||||
|
||||
// Group "Hooked Keys"
|
||||
public const String KeyHookKeys = "hookKeys";
|
||||
|
@ -1008,6 +1009,7 @@ namespace SebWindowsConfig
|
|||
SEBSettings.settingsDefault.Add(SEBSettings.KeyInsideSebEnableVmWareClientShade, false);
|
||||
SEBSettings.settingsDefault.Add(SEBSettings.KeyInsideSebEnableNetworkConnectionSelector, false);
|
||||
SEBSettings.settingsDefault.Add(SEBSettings.KeySetVmwareConfiguration, false);
|
||||
SEBSettings.settingsDefault.Add(SEBSettings.KeyEnableFindPrinter, false);
|
||||
|
||||
// Default settings for group "Hooked Keys"
|
||||
SEBSettings.settingsDefault.Add(SEBSettings.KeyHookKeys, true);
|
||||
|
|
31
SebWindowsConfig/SebWindowsConfigForm.Designer.cs
generated
31
SebWindowsConfig/SebWindowsConfigForm.Designer.cs
generated
|
@ -30,8 +30,8 @@ namespace SebWindowsConfig
|
|||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SebWindowsConfigForm));
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.openFileDialogSebConfigFile = new System.Windows.Forms.OpenFileDialog();
|
||||
this.saveFileDialogSebConfigFile = new System.Windows.Forms.SaveFileDialog();
|
||||
this.imageListTabIcons = new System.Windows.Forms.ImageList(this.components);
|
||||
|
@ -462,6 +462,7 @@ namespace SebWindowsConfig
|
|||
this.editDuplicateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.configureClientToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.applyAndStartSEBToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.checkBoxEnableFindPrinter = new System.Windows.Forms.CheckBox();
|
||||
this.tabPageHookedKeys.SuspendLayout();
|
||||
this.groupBoxFunctionKeys.SuspendLayout();
|
||||
this.groupBoxSpecialKeys.SuspendLayout();
|
||||
|
@ -933,6 +934,7 @@ namespace SebWindowsConfig
|
|||
//
|
||||
// groupBoxInsideSeb
|
||||
//
|
||||
this.groupBoxInsideSeb.Controls.Add(this.checkBoxEnableFindPrinter);
|
||||
this.groupBoxInsideSeb.Controls.Add(this.checkBoxSetVmwareConfiguration);
|
||||
this.groupBoxInsideSeb.Controls.Add(this.checkBoxInsideSebEnableNetworkConnectionSelector);
|
||||
this.groupBoxInsideSeb.Controls.Add(this.checkBoxInsideSebEnableSwitchUser);
|
||||
|
@ -948,7 +950,7 @@ namespace SebWindowsConfig
|
|||
this.groupBoxInsideSeb.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
|
||||
this.groupBoxInsideSeb.Name = "groupBoxInsideSeb";
|
||||
this.groupBoxInsideSeb.Padding = new System.Windows.Forms.Padding(2, 1, 2, 1);
|
||||
this.groupBoxInsideSeb.Size = new System.Drawing.Size(305, 245);
|
||||
this.groupBoxInsideSeb.Size = new System.Drawing.Size(305, 264);
|
||||
this.groupBoxInsideSeb.TabIndex = 25;
|
||||
this.groupBoxInsideSeb.TabStop = false;
|
||||
this.groupBoxInsideSeb.Text = "While running SEB";
|
||||
|
@ -971,7 +973,7 @@ namespace SebWindowsConfig
|
|||
//
|
||||
this.checkBoxInsideSebEnableNetworkConnectionSelector.AutoSize = true;
|
||||
this.checkBoxInsideSebEnableNetworkConnectionSelector.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.checkBoxInsideSebEnableNetworkConnectionSelector.Location = new System.Drawing.Point(16, 213);
|
||||
this.checkBoxInsideSebEnableNetworkConnectionSelector.Location = new System.Drawing.Point(16, 215);
|
||||
this.checkBoxInsideSebEnableNetworkConnectionSelector.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
|
||||
this.checkBoxInsideSebEnableNetworkConnectionSelector.Name = "checkBoxInsideSebEnableNetworkConnectionSelector";
|
||||
this.checkBoxInsideSebEnableNetworkConnectionSelector.Size = new System.Drawing.Size(196, 17);
|
||||
|
@ -1870,8 +1872,8 @@ namespace SebWindowsConfig
|
|||
//
|
||||
// Type
|
||||
//
|
||||
dataGridViewCellStyle1.BackColor = System.Drawing.Color.Silver;
|
||||
this.Type.DefaultCellStyle = dataGridViewCellStyle1;
|
||||
dataGridViewCellStyle5.BackColor = System.Drawing.Color.Silver;
|
||||
this.Type.DefaultCellStyle = dataGridViewCellStyle5;
|
||||
this.Type.HeaderText = "Type";
|
||||
this.Type.Name = "Type";
|
||||
this.Type.ReadOnly = true;
|
||||
|
@ -4610,8 +4612,8 @@ namespace SebWindowsConfig
|
|||
// spellCheckerDictionaryFilesColumn
|
||||
//
|
||||
this.spellCheckerDictionaryFilesColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.spellCheckerDictionaryFilesColumn.DefaultCellStyle = dataGridViewCellStyle2;
|
||||
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.spellCheckerDictionaryFilesColumn.DefaultCellStyle = dataGridViewCellStyle6;
|
||||
this.spellCheckerDictionaryFilesColumn.HeaderText = "Files";
|
||||
this.spellCheckerDictionaryFilesColumn.Name = "spellCheckerDictionaryFilesColumn";
|
||||
this.spellCheckerDictionaryFilesColumn.ReadOnly = true;
|
||||
|
@ -6009,6 +6011,18 @@ namespace SebWindowsConfig
|
|||
this.applyAndStartSEBToolStripMenuItem.Visible = false;
|
||||
this.applyAndStartSEBToolStripMenuItem.Click += new System.EventHandler(this.applyAndStartSEBToolStripMenuItem_Click);
|
||||
//
|
||||
// checkBoxEnableFindPrinter
|
||||
//
|
||||
this.checkBoxEnableFindPrinter.AutoSize = true;
|
||||
this.checkBoxEnableFindPrinter.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.checkBoxEnableFindPrinter.Location = new System.Drawing.Point(16, 236);
|
||||
this.checkBoxEnableFindPrinter.Name = "checkBoxEnableFindPrinter";
|
||||
this.checkBoxEnableFindPrinter.Size = new System.Drawing.Size(215, 17);
|
||||
this.checkBoxEnableFindPrinter.TabIndex = 78;
|
||||
this.checkBoxEnableFindPrinter.Text = "Enable Find Printer in system print dialog";
|
||||
this.checkBoxEnableFindPrinter.UseVisualStyleBackColor = true;
|
||||
this.checkBoxEnableFindPrinter.CheckedChanged += new System.EventHandler(this.checkBoxEnableFindPrinter_CheckedChanged);
|
||||
//
|
||||
// SebWindowsConfigForm
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
|
@ -6572,6 +6586,7 @@ namespace SebWindowsConfig
|
|||
private System.Windows.Forms.CheckBox checkBoxEnableMiddleMouse;
|
||||
private System.Windows.Forms.Label label26;
|
||||
private System.Windows.Forms.CheckBox checkBoxAllowPrint;
|
||||
private System.Windows.Forms.CheckBox checkBoxEnableFindPrinter;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -849,6 +849,7 @@ namespace SebWindowsConfig
|
|||
checkBoxInsideSebEnableVmWareClientShade.Enabled = checkBoxSetVmwareConfiguration.Checked;
|
||||
checkBoxInsideSebEnableVmWareClientShade.Checked = (Boolean) SEBSettings.settingsCurrent[SEBSettings.KeyInsideSebEnableVmWareClientShade];
|
||||
checkBoxInsideSebEnableNetworkConnectionSelector.Checked = (Boolean) SEBSettings.settingsCurrent[SEBSettings.KeyInsideSebEnableNetworkConnectionSelector];
|
||||
checkBoxEnableFindPrinter.Checked = (Boolean) SEBSettings.settingsCurrent[SEBSettings.KeyEnableFindPrinter];
|
||||
|
||||
// Group "Hooked Keys"
|
||||
checkBoxHookKeys.Checked = (Boolean) SEBSettings.settingsCurrent[SEBSettings.KeyHookKeys];
|
||||
|
@ -4677,5 +4678,10 @@ namespace SebWindowsConfig
|
|||
{
|
||||
SEBSettings.settingsCurrent[SEBSettings.KeyAllowPrint] = checkBoxAllowPrint.Checked;
|
||||
}
|
||||
|
||||
private void checkBoxEnableFindPrinter_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
SEBSettings.settingsCurrent[SEBSettings.KeyEnableFindPrinter] = checkBoxEnableFindPrinter.Checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue