Add EnableRemoteDesktop and DisableRemoteDesktop (#651)

Add ability to send EnableRemoteDesktop and DisableRemoteDesktop mdm-commands:
https://developer.apple.com/documentation/devicemanagement/enable_remote_desktop

Add test for EnableRemoteDesktop and DisableRemoteDesktop mdm-commands:
https://developer.apple.com/documentation/devicemanagement/enable_remote_desktop
This commit is contained in:
tomaswallentinus
2020-03-10 13:50:03 +01:00
committed by GitHub
parent 9e65297e46
commit e2acfb977e
10 changed files with 44 additions and 0 deletions

View File

@@ -28,6 +28,8 @@ message Command {
- DeviceConfigured
- AvailableOSUpdates
- NSExtensionMappings
- EnableRemoteDesktop
- DisableRemoteDesktop
- ActivationLockBypassCode
*/
oneof request {

View File

@@ -25,6 +25,8 @@ func (c *Command) MarshalJSON() ([]byte, error) {
"AvailableOSUpdates",
"NSExtensionMappings",
"OSUpdateStatus",
"EnableRemoteDesktop",
"DisableRemoteDesktop",
"ActivationLockBypassCode":
var x = struct {
RequestType string `json:"request_type"`

View File

@@ -27,6 +27,8 @@ func (c *Command) MarshalPlist() (interface{}, error) {
"AvailableOSUpdates",
"NSExtensionMappings",
"OSUpdateStatus",
"EnableRemoteDesktop",
"DisableRemoteDesktop",
"ActivationLockBypassCode":
return &struct {
RequestType string

View File

@@ -43,6 +43,8 @@ func commandToProto(cmd *Command) (*mdmproto.Command, error) {
"AvailableOSUpdates",
"NSExtensionMappings",
"OSUpdateStatus",
"EnableRemoteDesktop",
"DisableRemoteDesktop",
"ActivationLockBypassCode":
case "InstallProfile":

View File

@@ -52,6 +52,16 @@ func TestMarshalCommand(t *testing.T) {
},
},
},
{
Command: Command{
RequestType: "EnableRemoteDesktop",
},
},
{
Command: Command{
RequestType: "DisableRemoteDesktop",
},
},
}
for _, tt := range tests {
t.Run(tt.Command.RequestType+"_json", func(t *testing.T) {

View File

@@ -48,6 +48,8 @@ func (c *Command) UnmarshalJSON(data []byte) error {
"AvailableOSUpdates",
"NSExtensionMappings",
"OSUpdateStatus",
"EnableRemoteDesktop",
"DisableRemoteDesktop",
"ActivationLockBypassCode":
return nil
case "InstallProfile":

View File

@@ -34,6 +34,8 @@ func (c *Command) UnmarshalPlist(unmarshal func(i interface{}) error) error {
"AvailableOSUpdates",
"NSExtensionMappings",
"OSUpdateStatus",
"EnableRemoteDesktop",
"DisableRemoteDesktop",
"ActivationLockBypassCode":
return nil
case "InstallProfile":

View File

@@ -28,6 +28,8 @@ func protoToCommand(pb *mdmproto.Command) *Command {
"AvailableOSUpdates",
"NSExtensionMappings",
"OSUpdateStatus",
"EnableRemoteDesktop",
"DisableRemoteDesktop",
"ActivationLockBypassCode":
case "InstallProfile":

View File

@@ -0,0 +1,10 @@
#!/bin/bash
source $MICROMDM_ENV_PATH
endpoint="v1/commands"
jq -n \
--arg request_type "DisableRemoteDesktop" \
--arg udid "$1" \
'.udid = $udid
|.request_type = $request_type
'|\
curl $CURL_OPTS -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@-

View File

@@ -0,0 +1,10 @@
#!/bin/bash
source $MICROMDM_ENV_PATH
endpoint="v1/commands"
jq -n \
--arg request_type "EnableRemoteDesktop" \
--arg udid "$1" \
'.udid = $udid
|.request_type = $request_type
'|\
curl $CURL_OPTS -u "micromdm:$API_TOKEN" "$SERVER_URL/$endpoint" -d@-