mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 08:55:24 +00:00
Screen for unsupported MDM config profile payload types in CLI (#10098)
This commit is contained in:
parent
7e366272c0
commit
838645a905
@ -1480,6 +1480,11 @@ func (svc *Service) BatchSetMDMAppleProfiles(ctx context.Context, tmID *uint, tm
|
||||
"invalid mobileconfig profile")
|
||||
}
|
||||
|
||||
if err := mdmProf.ScreenPayloadTypes(); err != nil {
|
||||
return ctxerr.Wrap(ctx,
|
||||
fleet.NewInvalidArgumentError(fmt.Sprintf("profiles[%d]", i), err.Error()))
|
||||
}
|
||||
|
||||
if byName[mdmProf.Name] {
|
||||
return ctxerr.Wrap(ctx,
|
||||
fleet.NewInvalidArgumentError(fmt.Sprintf("profiles[%d]", i), fmt.Sprintf("Couldn’t edit custom_settings. More than one configuration profile have the same name (PayloadDisplayName): %q", mdmProf.Name)),
|
||||
|
@ -1159,6 +1159,47 @@ func TestMDMBatchSetAppleProfiles(t *testing.T) {
|
||||
},
|
||||
``,
|
||||
},
|
||||
{
|
||||
"unsupported payload type",
|
||||
&fleet.User{GlobalRole: ptr.String(fleet.RoleAdmin)},
|
||||
false,
|
||||
nil,
|
||||
nil,
|
||||
[][]byte{[]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>PayloadContent</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Enable</key>
|
||||
<string>On</string>
|
||||
<key>PayloadDisplayName</key>
|
||||
<string>FileVault 2</string>
|
||||
<key>PayloadIdentifier</key>
|
||||
<string>com.apple.MCX.FileVault2.A5874654-D6BA-4649-84B5-43847953B369</string>
|
||||
<key>PayloadType</key>
|
||||
<string>com.apple.MCX.FileVault2</string>
|
||||
<key>PayloadUUID</key>
|
||||
<string>A5874654-D6BA-4649-84B5-43847953B369</string>
|
||||
<key>PayloadVersion</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</array>
|
||||
<key>PayloadDisplayName</key>
|
||||
<string>Config Profile Name</string>
|
||||
<key>PayloadIdentifier</key>
|
||||
<string>com.example.config.FE42D0A2-DBA9-4B72-BC67-9288665B8D59</string>
|
||||
<key>PayloadType</key>
|
||||
<string>Configuration</string>
|
||||
<key>PayloadUUID</key>
|
||||
<string>FE42D0A2-DBA9-4B72-BC67-9288665B8D59</string>
|
||||
<key>PayloadVersion</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</plist>`)},
|
||||
"unsupported PayloadType(s)",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range testCases {
|
||||
|
Loading…
Reference in New Issue
Block a user