mirror of
https://github.com/micromdm/micromdm/
synced 2026-08-10 19:46:07 +08:00
@@ -1,6 +1,6 @@
|
||||
## [Unreleased](https://github.com/micromdm/micromdm/compare/v1.10.1...main)
|
||||
|
||||
This release is eagerly awaiting *your* awesome contribution!
|
||||
- Add SoftwareUpdateSettings to Settings command (#771, #856)
|
||||
|
||||
## [v1.10.1](https://github.com/micromdm/micromdm/compare/v1.10.0...v1.10.1) January 24, 2023
|
||||
|
||||
|
||||
@@ -234,6 +234,7 @@ type Setting struct {
|
||||
MDMOptions map[string]interface{} `plist:",omitempty" json:"mdm_options,omitempty"`
|
||||
PasscodeLockGracePeriod *int `plist:",omitempty" json:"passcode_lock_grace_period,omitempty"`
|
||||
MaximumResidentUsers *int `plist:",omitempty" json:"maximum_resident_users,omitempty"`
|
||||
RecommendationCadence *int `plist:",omitempty" json:"recommendation_cadence,omitempty"`
|
||||
Configuration map[string]interface{} `plist:",omitempty" json:"-"`
|
||||
ConfigurationData []byte `plist:"-" json:"configuration"` // used to build the dictionary
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -292,6 +292,7 @@ message Setting {
|
||||
AppAnalyticsSetting app_analytics = 14;
|
||||
ApplicationConfigurationSetting application_configuration = 15;
|
||||
TimeZoneSetting time_zone = 16;
|
||||
SoftwareUpdateSettingsSetting software_update_settings = 17;
|
||||
}
|
||||
|
||||
message VoiceRoamingSetting {
|
||||
@@ -337,6 +338,10 @@ message TimeZoneSetting {
|
||||
string time_zone = 1;
|
||||
}
|
||||
|
||||
message SoftwareUpdateSettingsSetting {
|
||||
int64 recommendation_cadence = 1;
|
||||
}
|
||||
|
||||
message HostnameSetting {
|
||||
string hostname = 1;
|
||||
}
|
||||
|
||||
@@ -514,6 +514,10 @@ func settingToProto(s Setting) *mdmproto.Setting {
|
||||
pbs.AppAnalytics = &mdmproto.AppAnalyticsSetting{
|
||||
Enabled: falseIfNil(s.Enabled),
|
||||
}
|
||||
case "SoftwareUpdateSettings":
|
||||
pbs.SoftwareUpdateSettings = &mdmproto.SoftwareUpdateSettingsSetting{
|
||||
RecommendationCadence: int64(zeroIntIfNil(s.RecommendationCadence)),
|
||||
}
|
||||
}
|
||||
return &pbs
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ Not tested end to end but checked against pdf:
|
||||
|
||||
func TestMarshalCommand(t *testing.T) {
|
||||
var deferrals int64 = 3
|
||||
var cadence int
|
||||
var tests = []struct {
|
||||
Command Command
|
||||
}{
|
||||
@@ -167,6 +168,14 @@ func TestMarshalCommand(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Command: Command{
|
||||
RequestType: "Settings",
|
||||
Settings: &Settings{
|
||||
Settings: []Setting{{Item: "SoftwareUpdateSettings", RecommendationCadence: &cadence}},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.Command.RequestType+"_json", func(t *testing.T) {
|
||||
@@ -573,6 +582,25 @@ func TestEndToEnd(t *testing.T) {
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "SoftwareUpdateSettings",
|
||||
requestBytes: []byte(
|
||||
`{"request_type":"Settings","settings":[{"item":"SoftwareUpdateSettings","recommendation_cadence":0}]}`,
|
||||
),
|
||||
testFn: func(t *testing.T, parts endToEndParts) {
|
||||
needToSee := [][]byte{
|
||||
[]byte(`Settings`),
|
||||
[]byte(`SoftwareUpdateSettings`),
|
||||
[]byte(`RecommendationCadence`),
|
||||
[]byte(`0`),
|
||||
}
|
||||
for _, b := range needToSee {
|
||||
if !bytes.Contains(parts.plistData, b) {
|
||||
t.Error(fmt.Sprintf("marshaled plist does not contain required bytes: '%s'", string(b)))
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
||||
@@ -455,6 +455,10 @@ func protoToSetting(s *mdmproto.Setting) Setting {
|
||||
case "AppAnalytics":
|
||||
pbs := s.GetAppAnalytics()
|
||||
setting.Enabled = nilIfFalse(pbs.GetEnabled())
|
||||
case "SoftwareUpdateSettings":
|
||||
pbs := s.GetSoftwareUpdateSettings()
|
||||
cadence := int(pbs.GetRecommendationCadence())
|
||||
setting.RecommendationCadence = &cadence
|
||||
}
|
||||
return setting
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user