Skip to content

Commit 247c4c5

Browse files
CopilotBornToBeRoot
andcommitted
Rename policy property to Update_CheckForUpdatesAtStartup and allow enabling/disabling
Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
1 parent 509ede8 commit 247c4c5

File tree

7 files changed

+35
-20
lines changed

7 files changed

+35
-20
lines changed

Documentation/config/README.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,32 @@ This directory contains an example `config.json` file that can be placed in the
1111

1212
## Configuration Options
1313

14-
### Update_DisableUpdateCheck
14+
### Update_CheckForUpdatesAtStartup
1515

16-
When set to `true`, disables the automatic update check at startup for all users.
16+
Controls whether the application checks for updates at startup for all users. This overrides the user's personal setting.
1717

18-
**Example:**
18+
- Set to `true` to enable automatic update checks at startup
19+
- Set to `false` to disable automatic update checks at startup
20+
- Omit the property to allow users to control this setting themselves
21+
22+
**Example (disable updates):**
23+
```json
24+
{
25+
"Update_CheckForUpdatesAtStartup": false
26+
}
27+
```
28+
29+
**Example (enable updates):**
1930
```json
2031
{
21-
"Update_DisableUpdateCheck": true
32+
"Update_CheckForUpdatesAtStartup": true
2233
}
2334
```
2435

2536
This is useful for enterprise deployments where you want to:
26-
- Control software updates centrally
27-
- Prevent users from being prompted about updates
28-
- Disable update checks on multiple machines without user intervention
37+
- Control software update checking behavior centrally
38+
- Ensure consistent update check behavior across all users
39+
- Either enforce update checks or prevent them system-wide
2940

3041
## File Location
3142

@@ -36,6 +47,7 @@ The `config.json` file should be placed in:
3647
## Notes
3748

3849
- System-wide configuration takes precedence over user settings
50+
- Users will see a message in the UI indicating when a setting is managed by the administrator
3951
- If the file doesn't exist or contains invalid JSON, it will be ignored and default user settings will apply
4052
- Changes to `config.json` require restarting the application to take effect
4153
- The file is optional - if not present, user settings will be used as normal
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"Update_DisableUpdateCheck": true
2+
"Update_CheckForUpdatesAtStartup": false
33
}

Source/NETworkManager.Settings/PolicyInfo.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ namespace NETworkManager.Settings;
99
public class PolicyInfo
1010
{
1111
/// <summary>
12-
/// Disable update check for all users. When set to true, the application will not check for updates at startup.
13-
/// This overrides the user's "Update_CheckForUpdatesAtStartup" setting.
12+
/// Controls the "Check for updates at startup" setting for all users.
13+
/// When set, this value overrides the user's "Update_CheckForUpdatesAtStartup" setting.
14+
/// Set to true to enable update checks, false to disable them.
1415
/// </summary>
15-
[JsonPropertyName("Update_DisableUpdateCheck")]
16-
public bool? Update_DisableUpdateCheck { get; set; }
16+
[JsonPropertyName("Update_CheckForUpdatesAtStartup")]
17+
public bool? Update_CheckForUpdatesAtStartup { get; set; }
1718
}

Source/NETworkManager.Settings/PolicyManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ public static void Load()
7373
Log.Info("System-wide policies loaded successfully.");
7474

7575
// Log enabled settings
76-
if (Current.Update_DisableUpdateCheck.HasValue)
76+
if (Current.Update_CheckForUpdatesAtStartup.HasValue)
7777
{
78-
Log.Info($"System-wide policy - Update_DisableUpdateCheck: {Current.Update_DisableUpdateCheck.Value}");
78+
Log.Info($"System-wide policy - Update_CheckForUpdatesAtStartup: {Current.Update_CheckForUpdatesAtStartup.Value}");
7979
}
8080
}
8181
catch (Exception ex)

Source/NETworkManager.Settings/SettingsManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ public static bool ShouldCheckForUpdatesAtStartup
6464
{
6565
get
6666
{
67-
// System-wide policy takes precedence - if it explicitly disables updates, honor it
68-
if (PolicyManager.Current?.Update_DisableUpdateCheck == true)
67+
// System-wide policy takes precedence - if set, use the policy value
68+
if (PolicyManager.Current?.Update_CheckForUpdatesAtStartup.HasValue == true)
6969
{
70-
return false;
70+
return PolicyManager.Current.Update_CheckForUpdatesAtStartup.Value;
7171
}
7272

7373
// Otherwise, use the user's setting
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"Update_DisableUpdateCheck": true
2+
"Update_CheckForUpdatesAtStartup": false
33
}

Source/NETworkManager/ViewModels/SettingsUpdateViewModel.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public bool CheckForUpdatesAtStartup
2929
/// <summary>
3030
/// Gets whether the "Check for updates at startup" setting is managed by system-wide policy.
3131
/// </summary>
32-
public bool IsUpdateCheckManagedByPolicy => PolicyManager.Current?.Update_DisableUpdateCheck.HasValue == true;
32+
public bool IsUpdateCheckManagedByPolicy => PolicyManager.Current?.Update_CheckForUpdatesAtStartup.HasValue == true;
3333

3434
private bool _checkForPreReleases;
3535

@@ -83,7 +83,9 @@ public SettingsUpdateViewModel()
8383

8484
private void LoadSettings()
8585
{
86-
CheckForUpdatesAtStartup = SettingsManager.Current.Update_CheckForUpdatesAtStartup;
86+
// If policy is set, show the policy value; otherwise show the user's setting
87+
CheckForUpdatesAtStartup = PolicyManager.Current?.Update_CheckForUpdatesAtStartup
88+
?? SettingsManager.Current.Update_CheckForUpdatesAtStartup;
8789
CheckForPreReleases = SettingsManager.Current.Update_CheckForPreReleases;
8890
EnableExperimentalFeatures = SettingsManager.Current.Experimental_EnableExperimentalFeatures;
8991
}

0 commit comments

Comments
 (0)