mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
[GPO; Enterprise] Updater policies (#24221)
* Implement GPO * Add GPOs in updater * Rename policy * fix * fix * Update GPOWrapper.h Added relative path to Generated Files folder for GPOWrapper.g.h * fix and inactivate PeriodicUpdateCheck gpo * Docs * GPO name change * Templates * Templates: Text changes * Templates: Text changes * Templates: Text changes * docs: spell fix * settings ui * fixes * fixes * fix gpo description * EOF fix * Fix include in UpdateUtils.cpp and remove build workaround * UI improvements * spell fixes * code improvements * Update README.md * Update PowerToys.adml * Update src/gpo/assets/PowerToys.admx * Remove forbidden pattern
This commit is contained in:
@@ -3040,4 +3040,7 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<value>Enable Mouse Jump</value>
|
||||
<comment>"Mouse Jump" is the name of the utility.</comment>
|
||||
</data>
|
||||
<data name="GPO_AutoDownloadUpdatesIsDisabled.Title" xml:space="preserve">
|
||||
<value>The system administrator has disabled the automatic download of updates.</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -142,6 +142,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
_updateCheckedDate = UpdatingSettingsConfig.LastCheckedDateLocalized;
|
||||
|
||||
_experimentationIsGpoDisallowed = GPOWrapper.GetAllowExperimentationValue() == GpoRuleConfigured.Disabled;
|
||||
_autoDownloadUpdatesIsGpoDisabled = GPOWrapper.GetDisableAutomaticUpdateDownloadValue() == GpoRuleConfigured.Enabled;
|
||||
|
||||
if (dispatcherAction != null)
|
||||
{
|
||||
@@ -156,6 +157,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
private int _themeIndex;
|
||||
|
||||
private bool _autoDownloadUpdates;
|
||||
private bool _autoDownloadUpdatesIsGpoDisabled;
|
||||
private bool _enableExperimentation;
|
||||
private bool _experimentationIsGpoDisallowed;
|
||||
|
||||
@@ -272,11 +274,20 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
// Are we running a dev build? (Please note that we verify this in the code that gets the newest version from GitHub too.)
|
||||
public static bool AutoUpdatesDisabledOnDevBuild
|
||||
{
|
||||
get
|
||||
{
|
||||
return Helper.GetProductVersion() == "v0.0.1";
|
||||
}
|
||||
}
|
||||
|
||||
public bool AutoDownloadUpdates
|
||||
{
|
||||
get
|
||||
{
|
||||
return _autoDownloadUpdates;
|
||||
return _autoDownloadUpdates && !_autoDownloadUpdatesIsGpoDisabled;
|
||||
}
|
||||
|
||||
set
|
||||
@@ -290,6 +301,18 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsAutoDownloadUpdatesCardEnabled
|
||||
{
|
||||
get => !AutoUpdatesDisabledOnDevBuild && !_autoDownloadUpdatesIsGpoDisabled;
|
||||
}
|
||||
|
||||
// The settings card is hidden for users who are not a member of the Administrators group and in this case the GPO info should be hidden too.
|
||||
// We hide it, because we don't want a normal user to enable the setting. He can't install the updates.
|
||||
public bool ShowAutoDownloadUpdatesGpoInformation
|
||||
{
|
||||
get => _isAdmin && _autoDownloadUpdatesIsGpoDisabled;
|
||||
}
|
||||
|
||||
public bool EnableExperimentation
|
||||
{
|
||||
get
|
||||
@@ -313,14 +336,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
get => _experimentationIsGpoDisallowed;
|
||||
}
|
||||
|
||||
public static bool AutoUpdatesEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return Helper.GetProductVersion() != "v0.0.1";
|
||||
}
|
||||
}
|
||||
|
||||
public string SettingsBackupAndRestoreDir
|
||||
{
|
||||
get
|
||||
@@ -659,7 +674,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
return AutoUpdatesEnabled && !IsNewVersionDownloading;
|
||||
return !AutoUpdatesDisabledOnDevBuild && !IsNewVersionDownloading;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -190,12 +190,18 @@
|
||||
<labs:SettingsCard
|
||||
x:Uid="GeneralPage_ToggleSwitch_AutoDownloadUpdates"
|
||||
Margin="0,-6,0,0"
|
||||
IsEnabled="{Binding AutoUpdatesEnabled}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsAutoDownloadUpdatesCardEnabled}"
|
||||
Visibility="{Binding Mode=OneWay, Path=IsAdmin, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<ToggleSwitch
|
||||
x:Uid="ToggleSwitch"
|
||||
IsOn="{Binding Mode=TwoWay, Path=AutoDownloadUpdates}" />
|
||||
</labs:SettingsCard>
|
||||
<InfoBar
|
||||
x:Uid="GPO_AutoDownloadUpdatesIsDisabled"
|
||||
IsClosable="False"
|
||||
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.ShowAutoDownloadUpdatesGpoInformation}"
|
||||
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.ShowAutoDownloadUpdatesGpoInformation}"
|
||||
Severity="Informational" />
|
||||
</controls:SettingsGroup>
|
||||
|
||||
<controls:SettingsGroup x:Uid="Admin_Mode">
|
||||
|
||||
Reference in New Issue
Block a user