Skip to content

Add system-wide policy configuration for centralized update control#3313

Merged
mergify[bot] merged 28 commits intomainfrom
copilot/disable-update-check-all-users
Feb 8, 2026
Merged

Add system-wide policy configuration for centralized update control#3313
mergify[bot] merged 28 commits intomainfrom
copilot/disable-update-check-all-users

Conversation

Copy link
Contributor

Copilot AI commented Feb 1, 2026

Changes proposed in this pull request

  • Implements PolicyManager/PolicyInfo to load system-wide policies from config.json in application directory, overriding user settings
  • Adds Update_CheckForUpdatesAtStartup boolean property enabling administrators to force enable/disable update checks for all users
  • UI automatically disables policy-managed settings with visual indicator (shield icon + localized "managed by administrator" message)
  • Includes config.json.example in installation output with inline usage documentation
  • Loads policies once in App.xaml.cs before settings initialization to avoid redundant calls
  • Policy precedence uses null-coalescing pattern: PolicyManager.Current?.Property ?? SettingsManager.Current.Property

Configuration format:

{
  "Update_CheckForUpdatesAtStartup": false
}

Code flow:

// App.xaml.cs - Load policies once at startup
PolicyManager.Load();
SettingsManager.Load();

// MainWindow.xaml.cs - Policy takes precedence
if (PolicyManager.Current?.Update_CheckForUpdatesAtStartup 
    ?? SettingsManager.Current.Update_CheckForUpdatesAtStartup)
{
    // Check for updates
}

Related issue(s)

Enterprise deployment requirement for centralized update control without per-user intervention.

Copilot generated summary

Copilot summary

This PR adds a system-wide policy mechanism via config.json alongside NETworkManager.exe to let administrators centrally control update-check behavior. It introduces PolicyManager/PolicyInfo classes that load before user settings to enforce machine-wide overrides. The UI automatically disables policy-managed settings and displays an admin indicator. Comprehensive documentation describes deployment patterns and troubleshooting. Build fixes included: React version alignment, CSS import corrections, and yarn.lock updates.

To-Do

Contributing

By submitting this pull request, I confirm the following:

Original prompt

This section details on the original issue you should resolve

<issue_title>Disable Update check for all users</issue_title>
<issue_description>Hi Team,

We are in testing process to deploy NETworkManager on multiple machines and need to disable auto update without user intervention.
Test environment is windows 11 virtual machines.

There is option to disable update during startup when we launch the application but that is user specific. Is there any way to disable autoupdate for all users like HKLM registry key,any file at program files or MSI parameter like AUTOUPDATE=0 which we can change, and this setting will be applicable for everyone who can login to that machine.</issue_description>

<agent_instructions>I want to implement something similar to the logpref feature from firefox. I config.json file in the app folder, that will disable the update check. It should be similar to the SettingsManager/SettingsInfo i already have implemented. The file should be loaded when loading the settingsmanager.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@BornToBeRoot Hi, is this currently not supported. There is currently no implementation to control settings via Registry, File, etc.

There is a feature request that my need a similar implementation via registry. #3208 #2787

For now this is just an update check and not an auto update. If you click on the update button... you will be redirected to the download page.</comment_new>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits February 1, 2026 20:35
Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
Copilot AI changed the title [WIP] Disable update check for all users in application Add system-wide configuration to disable update checks Feb 1, 2026
Copilot AI requested a review from BornToBeRoot February 1, 2026 20:40
@BornToBeRoot
Copy link
Owner

@copilot could the naming conflict with the existing ConfigurationManager?

Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 1, 2026

@copilot could the naming conflict with the existing ConfigurationManager?

Good catch! I've renamed ConfigManager to PolicyManager and ConfigInfo to PolicyInfo to avoid confusion with the existing ConfigurationManager. The new names better reflect that these are system-wide policies that override user settings. Fixed in commit 36e595c.

Copilot AI changed the title Add system-wide configuration to disable update checks Add system-wide policies to disable update checks Feb 1, 2026
@BornToBeRoot
Copy link
Owner

@copilot

  1. Make the example config part of the installation/default files
  2. Can we disable the setting in the settingsmanager/view and show a note that it's managed by the administrator?

Copilot AI and others added 3 commits February 7, 2026 23:45
…tings

Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 7, 2026

@copilot

  1. Make the example config part of the installation/default files
    ...

Both requests implemented:

  1. config.json.example in installation (commit 506e6bf): The example file is now included in the NETworkManager.csproj and will be copied to the output directory during build. Added usage instructions directly in the file.

  2. UI updates for policy-managed settings (commits 506e6bf, 1b12a86, 9ed5c23):

    • Toggle switch is automatically disabled when the setting is managed by policy
    • Added localized message "This setting is managed by your administrator" with shield icon (orange) that appears below the toggle
    • Icon improves accessibility for users with color vision deficiencies
    • Property IsUpdateCheckManagedByPolicy in ViewModel detects when policy is active

The UI clearly indicates to users when their update check setting is controlled by system policy.

Copilot AI changed the title Add system-wide policies to disable update checks Add system-wide policies to disable update checks with UI indicators Feb 7, 2026
@BornToBeRoot
Copy link
Owner

@copilot In the settings view, the value set by the administrator should be visible. Rename it to the same value as in settings manager (Update_CheckForUpdatesAtStartup). The admin should be able to "overwrite" it, not just disable, but also enable.

…nabling/disabling

Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 8, 2026

@copilot In the settings view, the value set by the administrator should be visible. Rename it to the same value as in settings manager (Update_CheckForUpdatesAtStartup). The admin should be able to "...

Implemented in commit 247c4c5:

  1. Property renamed: Changed from Update_DisableUpdateCheck to Update_CheckForUpdatesAtStartup to match SettingsManager
  2. Enable/disable capability: Administrators can now set the value to true (enable) or false (disable) - not just disable
  3. Value visible in UI: The toggle now displays the administrator's chosen value when policy is active

The ViewModel's LoadSettings() method now shows the policy value with: PolicyManager.Current?.Update_CheckForUpdatesAtStartup ?? SettingsManager.Current.Update_CheckForUpdatesAtStartup

Documentation and example files updated to reflect both enable and disable scenarios.

Copilot AI changed the title Add system-wide policies to disable update checks with UI indicators Add system-wide policies to control update checks with UI indicators Feb 8, 2026
@BornToBeRoot
Copy link
Owner

@copilot there is still an issue in the yarn build:

Run yarn build
yarn run v1.22.22
$ docusaurus build
Warning:  The `siteConfig.onBrokenMarkdownLinks` config option is deprecated and will be removed in Docusaurus v4.
Please migrate and move this option to `siteConfig.markdown.hooks.onBrokenMarkdownLinks` instead.
[INFO] [en] Creating an optimized production build...
Warning:  The `siteConfig.onBrokenMarkdownLinks` config option is deprecated and will be removed in Docusaurus v4.
Please migrate and move this option to `siteConfig.markdown.hooks.onBrokenMarkdownLinks` instead.
[info] [webpackbar] Compiling Client
[info] [webpackbar] Compiling Server
[success] [webpackbar] Server: Compiled successfully in 27.32s
[success] [webpackbar] Client: Compiled with some errors in 36.92s
Error:  Client bundle compiled with errors therefore further build is impossible.
Error: "./styles/css/image-gallery.css" is not exported under the condition "style" from package /home/runner/work/NETworkManager/NETworkManager/Website/node_modules/react-image-gallery (see exports field in /home/runner/work/NETworkManager/NETworkManager/Website/node_modules/react-image-gallery/package.json)

--------------------------

Error: "./styles/css/image-gallery.css" is not exported under the condition "style" from package /home/runner/work/NETworkManager/NETworkManager/Website/node_modules/react-image-gallery (see exports field in /home/runner/work/NETworkManager/NETworkManager/Website/node_modules/react-image-gallery/package.json)
-- inner error --
Error: "./styles/css/image-gallery.css" is not exported under the condition "style" from package /home/runner/work/NETworkManager/NETworkManager/Website/node_modules/react-image-gallery (see exports field in /home/runner/work/NETworkManager/NETworkManager/Website/node_modules/react-image-gallery/package.json)
Generated code for /home/runner/work/NETworkManager/NETworkManager/Website/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].use[1]!/home/runner/work/NETworkManager/NETworkManager/Website/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].use[2]!/home/runner/work/NETworkManager/NETworkManager/Website/src/css/custom.css
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Process completed with exit code 1.

Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 8, 2026

@copilot there is still an issue in the yarn build:

...

Fixed in commit c08bb42.

The issue was that the CSS import path was incorrect for react-image-gallery v2.0+. The package exports styles/image-gallery.css (not styles/css/image-gallery.css).

Changes made:

  • Removed the @import statement from Website/src/css/custom.css (CSS imports via @import don't work with package.json exports)
  • Added direct import in Website/src/pages/index.js: import "react-image-gallery/styles/image-gallery.css";
  • Used the correct export path that's defined in the package's exports field

This should resolve the webpack build error.

@BornToBeRoot
Copy link
Owner

@copilot now i get:

Error:  Error: Unable to build website for locale en.
    at tryToBuildLocale (/home/runner/work/NETworkManager/NETworkManager/Website/node_modules/@docusaurus/core/lib/commands/build/build.js:83:15)
    at async /home/runner/work/NETworkManager/NETworkManager/Website/node_modules/@docusaurus/core/lib/commands/build/build.js:35:9
    at async mapAsyncSequential (/home/runner/work/NETworkManager/NETworkManager/Website/node_modules/@docusaurus/utils/lib/jsUtils.js:21:24)
    at async Command.build (/home/runner/work/NETworkManager/NETworkManager/Website/node_modules/@docusaurus/core/lib/commands/build/build.js:34:5)
    at async Promise.all (index 0)
    at async runCLI (/home/runner/work/NETworkManager/NETworkManager/Website/node_modules/@docusaurus/core/lib/commands/cli.js:56:5)
    at async file:///home/runner/work/NETworkManager/NETworkManager/Website/node_modules/@docusaurus/core/bin/docusaurus.mjs:44:3 {
  [cause]: Error: Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:
    - react:      19.2.4
    - react-dom:  19.2.3
  Learn more: https://react.dev/warnings/version-mismatch
      at ensureCorrectIsomorphicReactVersion (server.bundle.js:54674:11)
      at 53839 (server.bundle.js:54680:1)
      at __webpack_require__ (server.bundle.js:64479:42)
      at 94362 (server.bundle.js:55516:7)
      at __webpack_require__ (server.bundle.js:64479:42)
      at 97422 (server.bundle.js:55501:18)
      at __webpack_require__ (server.bundle.js:64479:42)
      at 85598 (server.bundle.js:30497:74)
      at __webpack_require__ (server.bundle.js:64479:42)
      at 44905 (server.bundle.js:30547:71)
}
[INFO] Docusaurus version: 3.9.2
Node version: v20.20.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Process completed with exit code 1.

Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 8, 2026

@copilot now i get:

...

Fixed in commit 02b2ee7.

The error was caused by a version mismatch between React packages. The build requires that react and react-dom have the exact same version.

Changes made:

  • Updated react-dom from ^19.2.3 to ^19.2.4 in package.json to match the react version

This resolves the "Incompatible React versions" error. The Docusaurus build should now complete successfully.

Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
Copilot AI changed the title Add system-wide policies to control update checks with UI indicators and documentation Add system-wide policy configuration for centralized update control Feb 8, 2026
@BornToBeRoot
Copy link
Owner

@copilot the policy manager will not load if the settings are reset:

public static void Load()
{
// Load system-wide policies first (from app directory)
PolicyManager.Load();
}

Check the App.xaml.cs, or the ResetSettings() in SettingsSettingsViewModel.cs.

Should we load it in the app.xaml.cs ?

…ngs issue

Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 8, 2026

@copilot the policy manager will not load if the settings are reset:

public static void Load()
...

Fixed in commit 81feeb8.

Added PolicyManager.Load() to SettingsManager.Initialize() method. This ensures policies are loaded in all scenarios:

  1. Normal startup: SettingsManager.Load() → loads policies
  2. Reset via UI: SettingsManager.Initialize() → now loads policies
  3. Command line reset (--reset-settings): SettingsManager.Initialize() → now loads policies
  4. Corrupted settings recovery: SettingsManager.Initialize() → now loads policies

The PolicyManager now loads consistently regardless of which code path is taken during application startup or settings reset.

Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
@mergify mergify bot merged commit 908f891 into main Feb 8, 2026
4 checks passed
@mergify mergify bot deleted the copilot/disable-update-check-all-users branch February 8, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable Update check for all users

2 participants