mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
[MWB][Enterprise] Add new policies and improve settings UI for the Transfer File setting (#33571)
## Summary of the Pull Request ### Improve settings page for TransferFile setting The TransferFile setting depends on ShareClipboard setting. This is now visually shown. **Before the change:**  **After the change**  ### New policies are added for MWB Name | Supported states | Id | Behavior ------------ | ------------- | ------------ | ------------- Clipboard sharing enabled | disabled | MwbClipboardSharingEnabled | Disables the feature if set to disabled. File transfer enabled | disabled | MwbFileTransferEnabled | Disables the feature if set to disabled. Original user interface enabled | disabled | MwbUseOriginalUserInterface | Disables the feature if set to disabled. | Disallow blocking screensaver on other machines | enabled | MwbDisallowBlockingScreensaver | Disables the feature if set to enabled. | Connect only in same subnet | enabled & disabled | MwbSameSubnetOnly | Enables the feature if set to enabled.<br />Disables the feature if set to disabled. | Validate remote machine IP Address | enabled & disabled | MwbValidateRemoteIp | Enables the feature if set to enabled.<br />Disables the feature if set to disabled. Disable user defined IP Address mapping rules | enabled | MwbDisableUserDefinedIpMappingRules | If enabled the user can't define IP Address mapping rules. Predefined IP Address mappings | enabled with multi-line text value | MwbPolicyDefinedIpMappingRules | Allows admins to force define IP Address mapping rules. #### User Interface screenshots   
This commit is contained in:
@@ -12,8 +12,10 @@ using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using global::PowerToys.GPOWrapper;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
|
||||
@@ -259,6 +261,11 @@ namespace MouseWithoutBorders.Class
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GPOWrapper.GetConfiguredMwbClipboardSharingEnabledValue() == GpoRuleConfigured.Disabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
return _properties.ShareClipboard;
|
||||
@@ -267,6 +274,11 @@ namespace MouseWithoutBorders.Class
|
||||
|
||||
set
|
||||
{
|
||||
if (ShareClipboardIsGpoConfigured)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
_properties.ShareClipboard = value;
|
||||
@@ -274,10 +286,19 @@ namespace MouseWithoutBorders.Class
|
||||
}
|
||||
}
|
||||
|
||||
[CmdConfigureIgnore]
|
||||
[JsonIgnore]
|
||||
internal bool ShareClipboardIsGpoConfigured => GPOWrapper.GetConfiguredMwbClipboardSharingEnabledValue() == GpoRuleConfigured.Disabled;
|
||||
|
||||
internal bool TransferFile
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GPOWrapper.GetConfiguredMwbFileTransferEnabledValue() == GpoRuleConfigured.Disabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
return _properties.TransferFile;
|
||||
@@ -286,10 +307,19 @@ namespace MouseWithoutBorders.Class
|
||||
|
||||
set
|
||||
{
|
||||
if (TransferFileIsGpoConfigured)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_properties.TransferFile = value;
|
||||
}
|
||||
}
|
||||
|
||||
[CmdConfigureIgnore]
|
||||
[JsonIgnore]
|
||||
internal bool TransferFileIsGpoConfigured => GPOWrapper.GetConfiguredMwbFileTransferEnabledValue() == GpoRuleConfigured.Disabled;
|
||||
|
||||
internal bool MatrixOneRow
|
||||
{
|
||||
get
|
||||
@@ -491,6 +521,11 @@ namespace MouseWithoutBorders.Class
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GPOWrapper.GetConfiguredMwbDisallowBlockingScreensaverValue() == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
return _properties.BlockScreenSaverOnOtherMachines;
|
||||
@@ -499,6 +534,11 @@ namespace MouseWithoutBorders.Class
|
||||
|
||||
set
|
||||
{
|
||||
if (BlockScreenSaverIsGpoConfigured)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
_properties.BlockScreenSaverOnOtherMachines = value;
|
||||
@@ -506,6 +546,10 @@ namespace MouseWithoutBorders.Class
|
||||
}
|
||||
}
|
||||
|
||||
[CmdConfigureIgnore]
|
||||
[JsonIgnore]
|
||||
internal bool BlockScreenSaverIsGpoConfigured => GPOWrapper.GetConfiguredMwbDisallowBlockingScreensaverValue() == GpoRuleConfigured.Enabled;
|
||||
|
||||
internal bool MoveMouseRelatively
|
||||
{
|
||||
get
|
||||
@@ -795,6 +839,15 @@ namespace MouseWithoutBorders.Class
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GPOWrapper.GetConfiguredMwbValidateRemoteIpValue() == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (GPOWrapper.GetConfiguredMwbValidateRemoteIpValue() == GpoRuleConfigured.Disabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
return _properties.ValidateRemoteMachineIP;
|
||||
@@ -803,6 +856,11 @@ namespace MouseWithoutBorders.Class
|
||||
|
||||
set
|
||||
{
|
||||
if (ReverseLookupIsGpoConfigured)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
_properties.ValidateRemoteMachineIP = value;
|
||||
@@ -810,10 +868,23 @@ namespace MouseWithoutBorders.Class
|
||||
}
|
||||
}
|
||||
|
||||
[CmdConfigureIgnore]
|
||||
[JsonIgnore]
|
||||
internal bool ReverseLookupIsGpoConfigured => GPOWrapper.GetConfiguredMwbValidateRemoteIpValue() == GpoRuleConfigured.Enabled || GPOWrapper.GetConfiguredMwbValidateRemoteIpValue() == GpoRuleConfigured.Disabled;
|
||||
|
||||
internal bool SameSubNetOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GPOWrapper.GetConfiguredMwbSameSubnetOnlyValue() == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (GPOWrapper.GetConfiguredMwbSameSubnetOnlyValue() == GpoRuleConfigured.Disabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
return _properties.SameSubnetOnly;
|
||||
@@ -822,6 +893,11 @@ namespace MouseWithoutBorders.Class
|
||||
|
||||
set
|
||||
{
|
||||
if (SameSubNetOnlyIsGpoConfigured)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
_properties.SameSubnetOnly = value;
|
||||
@@ -829,10 +905,19 @@ namespace MouseWithoutBorders.Class
|
||||
}
|
||||
}
|
||||
|
||||
[CmdConfigureIgnore]
|
||||
[JsonIgnore]
|
||||
internal bool SameSubNetOnlyIsGpoConfigured => GPOWrapper.GetConfiguredMwbSameSubnetOnlyValue() == GpoRuleConfigured.Enabled || GPOWrapper.GetConfiguredMwbSameSubnetOnlyValue() == GpoRuleConfigured.Disabled;
|
||||
|
||||
internal string Name2IP
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GPOWrapper.GetConfiguredMwbDisableUserDefinedIpMappingRulesValue() == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
return _properties.Name2IP.Value;
|
||||
@@ -841,6 +926,11 @@ namespace MouseWithoutBorders.Class
|
||||
|
||||
set
|
||||
{
|
||||
if (Name2IpIsGpoConfigured)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
_properties.Name2IP.Value = value;
|
||||
@@ -848,6 +938,18 @@ namespace MouseWithoutBorders.Class
|
||||
}
|
||||
}
|
||||
|
||||
[CmdConfigureIgnore]
|
||||
[JsonIgnore]
|
||||
internal bool Name2IpIsGpoConfigured => GPOWrapper.GetConfiguredMwbDisableUserDefinedIpMappingRulesValue() == GpoRuleConfigured.Enabled;
|
||||
|
||||
[CmdConfigureIgnore]
|
||||
[JsonIgnore]
|
||||
internal string Name2IpPolicyList => GPOWrapper.GetConfiguredMwbPolicyDefinedIpMappingRules();
|
||||
|
||||
[CmdConfigureIgnore]
|
||||
[JsonIgnore]
|
||||
internal bool Name2IpPolicyListIsGpoConfigured => !string.IsNullOrWhiteSpace(Name2IpPolicyList);
|
||||
|
||||
internal bool FirstCtrlShiftS
|
||||
{
|
||||
get
|
||||
@@ -954,6 +1056,11 @@ namespace MouseWithoutBorders.Class
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GPOWrapper.GetConfiguredMwbUseOriginalUserInterfaceValue() == GpoRuleConfigured.Disabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
return _properties.ShowOriginalUI;
|
||||
@@ -962,6 +1069,11 @@ namespace MouseWithoutBorders.Class
|
||||
|
||||
set
|
||||
{
|
||||
if (GPOWrapper.GetConfiguredMwbUseOriginalUserInterfaceValue() == GpoRuleConfigured.Disabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lock (_loadingSettingsLock)
|
||||
{
|
||||
_properties.ShowOriginalUI = value;
|
||||
|
||||
Reference in New Issue
Block a user