mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[PTRun][Enterprise]GPO for plugin enabled state (#27468)
* try code for gpo with pluginID param * fix typo * fixes * update admx * Add second policy to admx * spelling fixes * admx clean up * add gpo code * small fixes * fixes * fix cast * update settings code * bug fixes * fix plugins disabled warning * Info bar in settings * settings ui fixes * code clean up * fix spelling * fix spelling * code optimization * changes * fix code * switch to char* * update comments * validate plugin ID * spell fixes * spell fixes * fix IPlugin interface * Update Directory.Packages.props hopefully fixes unit tests * revert change of nuget pkg * fixes * fix spell check * add todo comment * improve gpo.h * improve gpo.h * update gpo.h * clean up code in gpo.h * fix build * try to fix build * xaml fix * Fix getting string value from the registry * communicate policy state suing settings.json * various changes and gpo docs * spell fixes * PT Run: Policy handling * spell fix * fix logging * fix admx revision * revision fix 2 * review feedback 1 * review feedback 2 * dev docs update * fix typo
This commit is contained in:
@@ -11,6 +11,8 @@ using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using global::PowerToys.GPOWrapper;
|
||||
using ManagedCommon;
|
||||
using PowerLauncher.Properties;
|
||||
using Wox.Infrastructure.Storage;
|
||||
using Wox.Plugin;
|
||||
@@ -140,6 +142,25 @@ namespace PowerLauncher.Plugin
|
||||
var failedPlugins = new ConcurrentQueue<PluginPair>();
|
||||
Parallel.ForEach(AllPlugins, pair =>
|
||||
{
|
||||
// Check policy state for the plugin and update metadata
|
||||
var enabledPolicyState = GPOWrapper.GetRunPluginEnabledValue(pair.Metadata.ID);
|
||||
if (enabledPolicyState == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
pair.Metadata.Disabled = false;
|
||||
pair.Metadata.IsEnabledPolicyConfigured = true;
|
||||
Log.Info($"The plugin <{pair.Metadata.Name}> is enabled by policy.", typeof(PluginManager));
|
||||
}
|
||||
else if (enabledPolicyState == GpoRuleConfigured.Disabled)
|
||||
{
|
||||
pair.Metadata.Disabled = true;
|
||||
pair.Metadata.IsEnabledPolicyConfigured = true;
|
||||
Log.Info($"The plugin <{pair.Metadata.Name}> is disabled by policy.", typeof(PluginManager));
|
||||
}
|
||||
else if (enabledPolicyState == GpoRuleConfigured.WrongValue)
|
||||
{
|
||||
Log.Warn($"Wrong policy value for enabled policy for plugin <{pair.Metadata.Name}>.", typeof(PluginManager));
|
||||
}
|
||||
|
||||
if (pair.Metadata.Disabled)
|
||||
{
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user