SEBWIN-319: Forgot user-specific registry key for power options.

This commit is contained in:
dbuechel 2019-08-13 08:29:48 +02:00
parent e1b467d984
commit 6a1632ee48
7 changed files with 63 additions and 17 deletions

View file

@ -41,16 +41,16 @@ namespace SafeExamBrowser.Contracts.Lockdown
/// </summary> /// </summary>
IFeatureConfiguration CreateLockWorkstationConfiguration(Guid groupId, string sid, string userName); IFeatureConfiguration CreateLockWorkstationConfiguration(Guid groupId, string sid, string userName);
/// <summary>
/// Creates an <see cref="IFeatureConfiguration"/> to control the power options on the security screen.
/// </summary>
IFeatureConfiguration CreateMachinePowerOptionsConfiguration(Guid groupId);
/// <summary> /// <summary>
/// Creates an <see cref="IFeatureConfiguration"/> to control the network options on the security screen. /// Creates an <see cref="IFeatureConfiguration"/> to control the network options on the security screen.
/// </summary> /// </summary>
IFeatureConfiguration CreateNetworkOptionsConfiguration(Guid groupId); IFeatureConfiguration CreateNetworkOptionsConfiguration(Guid groupId);
/// <summary>
/// Creates an <see cref="IFeatureConfiguration"/> to control the power options on the security screen.
/// </summary>
IFeatureConfiguration CreatePowerOptionsConfiguration(Guid groupId);
/// <summary> /// <summary>
/// Creates an <see cref="IFeatureConfiguration"/> to control remote desktop connections. /// Creates an <see cref="IFeatureConfiguration"/> to control remote desktop connections.
/// </summary> /// </summary>
@ -71,6 +71,11 @@ namespace SafeExamBrowser.Contracts.Lockdown
/// </summary> /// </summary>
IFeatureConfiguration CreateTaskManagerConfiguration(Guid groupId, string sid, string userName); IFeatureConfiguration CreateTaskManagerConfiguration(Guid groupId, string sid, string userName);
/// <summary>
/// Creates an <see cref="IFeatureConfiguration"/> to control the power options in the start menu.
/// </summary>
IFeatureConfiguration CreateUserPowerOptionsConfiguration(Guid groupId, string sid, string userName);
/// <summary> /// <summary>
/// Creates an <see cref="IFeatureConfiguration"/> to control the user interface overlay for VMware clients. /// Creates an <see cref="IFeatureConfiguration"/> to control the user interface overlay for VMware clients.
/// </summary> /// </summary>

View file

@ -33,12 +33,13 @@ namespace SafeExamBrowser.Lockdown
CreateChromeNotificationConfiguration(groupId, sid, userName), CreateChromeNotificationConfiguration(groupId, sid, userName),
CreateEaseOfAccessConfiguration(groupId), CreateEaseOfAccessConfiguration(groupId),
CreateLockWorkstationConfiguration(groupId, sid, userName), CreateLockWorkstationConfiguration(groupId, sid, userName),
CreateMachinePowerOptionsConfiguration(groupId),
CreateNetworkOptionsConfiguration(groupId), CreateNetworkOptionsConfiguration(groupId),
CreatePowerOptionsConfiguration(groupId),
CreateRemoteConnectionConfiguration(groupId), CreateRemoteConnectionConfiguration(groupId),
CreateSignoutConfiguration(groupId, sid, userName), CreateSignoutConfiguration(groupId, sid, userName),
CreateSwitchUserConfiguration(groupId), CreateSwitchUserConfiguration(groupId),
CreateTaskManagerConfiguration(groupId, sid, userName), CreateTaskManagerConfiguration(groupId, sid, userName),
CreateUserPowerOptionsConfiguration(groupId, sid, userName),
CreateVmwareOverlayConfiguration(groupId, sid, userName), CreateVmwareOverlayConfiguration(groupId, sid, userName),
CreateWindowsUpdateConfiguration(groupId) CreateWindowsUpdateConfiguration(groupId)
}; };
@ -64,16 +65,16 @@ namespace SafeExamBrowser.Lockdown
return new LockWorkstationConfiguration(groupId, logger.CloneFor(nameof(LockWorkstationConfiguration)), sid, userName); return new LockWorkstationConfiguration(groupId, logger.CloneFor(nameof(LockWorkstationConfiguration)), sid, userName);
} }
public IFeatureConfiguration CreateMachinePowerOptionsConfiguration(Guid groupId)
{
return new MachinePowerOptionsConfiguration(groupId, logger.CloneFor(nameof(MachinePowerOptionsConfiguration)));
}
public IFeatureConfiguration CreateNetworkOptionsConfiguration(Guid groupId) public IFeatureConfiguration CreateNetworkOptionsConfiguration(Guid groupId)
{ {
return new NetworkOptionsConfiguration(groupId, logger.CloneFor(nameof(NetworkOptionsConfiguration))); return new NetworkOptionsConfiguration(groupId, logger.CloneFor(nameof(NetworkOptionsConfiguration)));
} }
public IFeatureConfiguration CreatePowerOptionsConfiguration(Guid groupId)
{
return new PowerOptionsConfiguration(groupId, logger.CloneFor(nameof(PowerOptionsConfiguration)));
}
public IFeatureConfiguration CreateRemoteConnectionConfiguration(Guid groupId) public IFeatureConfiguration CreateRemoteConnectionConfiguration(Guid groupId)
{ {
return new RemoteConnectionConfiguration(groupId, logger.CloneFor(nameof(RemoteConnectionConfiguration))); return new RemoteConnectionConfiguration(groupId, logger.CloneFor(nameof(RemoteConnectionConfiguration)));
@ -94,6 +95,11 @@ namespace SafeExamBrowser.Lockdown
return new TaskManagerConfiguration(groupId, logger.CloneFor(nameof(TaskManagerConfiguration)), sid, userName); return new TaskManagerConfiguration(groupId, logger.CloneFor(nameof(TaskManagerConfiguration)), sid, userName);
} }
public IFeatureConfiguration CreateUserPowerOptionsConfiguration(Guid groupId, string sid, string userName)
{
return new UserPowerOptionsConfiguration(groupId, logger.CloneFor(nameof(UserPowerOptionsConfiguration)), sid, userName);
}
public IFeatureConfiguration CreateVmwareOverlayConfiguration(Guid groupId, string sid, string userName) public IFeatureConfiguration CreateVmwareOverlayConfiguration(Guid groupId, string sid, string userName)
{ {
return new VmwareOverlayConfiguration(groupId, logger.CloneFor(nameof(VmwareOverlayConfiguration)), sid, userName); return new VmwareOverlayConfiguration(groupId, logger.CloneFor(nameof(VmwareOverlayConfiguration)), sid, userName);

View file

@ -13,14 +13,14 @@ using SafeExamBrowser.Contracts.Logging;
namespace SafeExamBrowser.Lockdown.FeatureConfigurations.RegistryConfigurations.MachineHive namespace SafeExamBrowser.Lockdown.FeatureConfigurations.RegistryConfigurations.MachineHive
{ {
[Serializable] [Serializable]
internal class PowerOptionsConfiguration : MachineHiveConfiguration internal class MachinePowerOptionsConfiguration : MachineHiveConfiguration
{ {
protected override IEnumerable<RegistryConfigurationItem> Items => new [] protected override IEnumerable<RegistryConfigurationItem> Items => new []
{ {
new RegistryConfigurationItem(@"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoClose", 1, 0) new RegistryConfigurationItem(@"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoClose", 1, 0)
}; };
public PowerOptionsConfiguration(Guid groupId, ILogger logger) : base(groupId, logger) public MachinePowerOptionsConfiguration(Guid groupId, ILogger logger) : base(groupId, logger)
{ {
} }

View file

@ -0,0 +1,32 @@
/*
* Copyright (c) 2019 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.Contracts.Logging;
namespace SafeExamBrowser.Lockdown.FeatureConfigurations.RegistryConfigurations.UserHive
{
[Serializable]
internal class UserPowerOptionsConfiguration : UserHiveConfiguration
{
protected override IEnumerable<RegistryConfigurationItem> Items => new[]
{
new RegistryConfigurationItem($@"HKEY_USERS\{SID}\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoClose", 1, 0)
};
public UserPowerOptionsConfiguration(Guid groupId, ILogger logger, string sid, string userName) : base(groupId, logger, sid, userName)
{
}
public override bool Reset()
{
return DeleteConfiguration();
}
}
}

View file

@ -64,12 +64,13 @@
<Compile Include="FeatureConfigurations\FeatureConfiguration.cs" /> <Compile Include="FeatureConfigurations\FeatureConfiguration.cs" />
<Compile Include="FeatureConfigurations\RegistryConfigurations\MachineHive\MachineHiveConfiguration.cs" /> <Compile Include="FeatureConfigurations\RegistryConfigurations\MachineHive\MachineHiveConfiguration.cs" />
<Compile Include="FeatureConfigurations\RegistryConfigurations\RegistryConfiguration.cs" /> <Compile Include="FeatureConfigurations\RegistryConfigurations\RegistryConfiguration.cs" />
<Compile Include="FeatureConfigurations\RegistryConfigurations\UserHive\UserPowerOptionsConfiguration.cs" />
<Compile Include="FeatureConfigurations\RegistryConfigurations\UserHive\UserHiveConfiguration.cs" /> <Compile Include="FeatureConfigurations\RegistryConfigurations\UserHive\UserHiveConfiguration.cs" />
<Compile Include="FeatureConfigurations\RegistryConfigurations\UserHive\TaskManagerConfiguration.cs" /> <Compile Include="FeatureConfigurations\RegistryConfigurations\UserHive\TaskManagerConfiguration.cs" />
<Compile Include="FeatureConfigurations\RegistryConfigurations\MachineHive\EaseOfAccessConfiguration.cs" /> <Compile Include="FeatureConfigurations\RegistryConfigurations\MachineHive\EaseOfAccessConfiguration.cs" />
<Compile Include="FeatureConfigurations\RegistryConfigurations\MachineHive\NetworkOptionsConfiguration.cs" /> <Compile Include="FeatureConfigurations\RegistryConfigurations\MachineHive\NetworkOptionsConfiguration.cs" />
<Compile Include="FeatureConfigurations\RegistryConfigurations\UserHive\ChangePasswordConfiguration.cs" /> <Compile Include="FeatureConfigurations\RegistryConfigurations\UserHive\ChangePasswordConfiguration.cs" />
<Compile Include="FeatureConfigurations\RegistryConfigurations\MachineHive\PowerOptionsConfiguration.cs" /> <Compile Include="FeatureConfigurations\RegistryConfigurations\MachineHive\MachinePowerOptionsConfiguration.cs" />
<Compile Include="FeatureConfigurations\RegistryConfigurations\MachineHive\RemoteConnectionConfiguration.cs" /> <Compile Include="FeatureConfigurations\RegistryConfigurations\MachineHive\RemoteConnectionConfiguration.cs" />
<Compile Include="FeatureConfigurations\RegistryConfigurations\UserHive\SignoutConfiguration.cs" /> <Compile Include="FeatureConfigurations\RegistryConfigurations\UserHive\SignoutConfiguration.cs" />
<Compile Include="FeatureConfigurations\RegistryConfigurations\UserHive\LockWorkstationConfiguration.cs" /> <Compile Include="FeatureConfigurations\RegistryConfigurations\UserHive\LockWorkstationConfiguration.cs" />

View file

@ -56,7 +56,7 @@ namespace SafeExamBrowser.Service.UnitTests.Operations
configuration.SetReturnsDefault(true); configuration.SetReturnsDefault(true);
factory.SetReturnsDefault(configuration.Object); factory.SetReturnsDefault(configuration.Object);
settings.Service.DisableChromeNotifications = true; settings.Service.DisableChromeNotifications = true;
settings.Service.DisablePowerOptions = true; settings.Service.DisableEaseOfAccessOptions = true;
settings.Service.DisableSignout = true; settings.Service.DisableSignout = true;
var result = sut.Perform(); var result = sut.Perform();
@ -91,12 +91,13 @@ namespace SafeExamBrowser.Service.UnitTests.Operations
factory.Verify(f => f.CreateChromeNotificationConfiguration(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.CreateEaseOfAccessConfiguration(It.Is<Guid>(id => id == groupId)), 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.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); factory.Verify(f => f.CreateNetworkOptionsConfiguration(It.Is<Guid>(id => id == groupId)), Times.Once);
factory.Verify(f => f.CreatePowerOptionsConfiguration(It.Is<Guid>(id => id == groupId)), Times.Once);
factory.Verify(f => f.CreateRemoteConnectionConfiguration(It.Is<Guid>(id => id == groupId)), Times.Once); factory.Verify(f => f.CreateRemoteConnectionConfiguration(It.Is<Guid>(id => id == groupId)), Times.Once);
factory.Verify(f => f.CreateSignoutConfiguration(It.Is<Guid>(id => id == groupId), It.IsAny<string>(), It.IsAny<string>()), Times.Once); factory.Verify(f => f.CreateSignoutConfiguration(It.Is<Guid>(id => id == groupId), It.IsAny<string>(), It.IsAny<string>()), Times.Once);
factory.Verify(f => f.CreateSwitchUserConfiguration(It.Is<Guid>(id => id == groupId)), Times.Once); factory.Verify(f => f.CreateSwitchUserConfiguration(It.Is<Guid>(id => id == groupId)), Times.Once);
factory.Verify(f => f.CreateTaskManagerConfiguration(It.Is<Guid>(id => id == groupId), It.IsAny<string>(), It.IsAny<string>()), Times.Once); factory.Verify(f => f.CreateTaskManagerConfiguration(It.Is<Guid>(id => id == groupId), It.IsAny<string>(), It.IsAny<string>()), Times.Once);
factory.Verify(f => f.CreateUserPowerOptionsConfiguration(It.Is<Guid>(id => id == groupId), It.IsAny<string>(), It.IsAny<string>()), Times.Once);
factory.Verify(f => f.CreateVmwareOverlayConfiguration(It.Is<Guid>(id => id == groupId), It.IsAny<string>(), It.IsAny<string>()), Times.Once); factory.Verify(f => f.CreateVmwareOverlayConfiguration(It.Is<Guid>(id => id == groupId), It.IsAny<string>(), It.IsAny<string>()), Times.Once);
factory.Verify(f => f.CreateWindowsUpdateConfiguration(It.Is<Guid>(id => id == groupId)), Times.Once); factory.Verify(f => f.CreateWindowsUpdateConfiguration(It.Is<Guid>(id => id == groupId)), Times.Once);
} }

View file

@ -47,12 +47,13 @@ namespace SafeExamBrowser.Service.Operations
(factory.CreateChromeNotificationConfiguration(groupId, sid, userName), Context.Configuration.Settings.Service.DisableChromeNotifications), (factory.CreateChromeNotificationConfiguration(groupId, sid, userName), Context.Configuration.Settings.Service.DisableChromeNotifications),
(factory.CreateEaseOfAccessConfiguration(groupId), Context.Configuration.Settings.Service.DisableEaseOfAccessOptions), (factory.CreateEaseOfAccessConfiguration(groupId), Context.Configuration.Settings.Service.DisableEaseOfAccessOptions),
(factory.CreateLockWorkstationConfiguration(groupId, sid, userName), Context.Configuration.Settings.Service.DisableUserLock), (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), (factory.CreateNetworkOptionsConfiguration(groupId), Context.Configuration.Settings.Service.DisableNetworkOptions),
(factory.CreatePowerOptionsConfiguration(groupId), Context.Configuration.Settings.Service.DisablePowerOptions),
(factory.CreateRemoteConnectionConfiguration(groupId), Context.Configuration.Settings.Service.DisableRemoteConnections), (factory.CreateRemoteConnectionConfiguration(groupId), Context.Configuration.Settings.Service.DisableRemoteConnections),
(factory.CreateSignoutConfiguration(groupId, sid, userName), Context.Configuration.Settings.Service.DisableSignout), (factory.CreateSignoutConfiguration(groupId, sid, userName), Context.Configuration.Settings.Service.DisableSignout),
(factory.CreateSwitchUserConfiguration(groupId), Context.Configuration.Settings.Service.DisableUserSwitch), (factory.CreateSwitchUserConfiguration(groupId), Context.Configuration.Settings.Service.DisableUserSwitch),
(factory.CreateTaskManagerConfiguration(groupId, sid, userName), Context.Configuration.Settings.Service.DisableTaskManager), (factory.CreateTaskManagerConfiguration(groupId, sid, userName), Context.Configuration.Settings.Service.DisableTaskManager),
(factory.CreateUserPowerOptionsConfiguration(groupId, sid, userName), Context.Configuration.Settings.Service.DisablePowerOptions),
(factory.CreateVmwareOverlayConfiguration(groupId, sid, userName), Context.Configuration.Settings.Service.DisableVmwareOverlay), (factory.CreateVmwareOverlayConfiguration(groupId, sid, userName), Context.Configuration.Settings.Service.DisableVmwareOverlay),
(factory.CreateWindowsUpdateConfiguration(groupId), Context.Configuration.Settings.Service.DisableWindowsUpdate) (factory.CreateWindowsUpdateConfiguration(groupId), Context.Configuration.Settings.Service.DisableWindowsUpdate)
}; };