Handle ActivationLockBypassCode Request (#578)

* add ActivationLockBypassCode Request

* Update mdm.pb.go

fixed typo

* Update mdm.pb.go

add Size method

* Update unmarshal_proto.go

remove pbc

* add api script for activation_lock_bypass_code

* update Changelog

* Simplify Code

I was able to simplify the code as ActivationLockBypassCode does not have any additional fields.

* Update command.go

Remove ActivationLockBypassCode struct as ActivationLockBypassCode does not include any extra fields.
This commit is contained in:
jenjac
2019-03-04 14:55:51 -06:00
committed by Scott Knight
parent b50412f80a
commit 8e0d722d61
10 changed files with 31 additions and 12 deletions

View File

@@ -7,6 +7,7 @@
* Remove deprecated `-apns` flags from server startup (#528)
* Move API calls to list endpoints from HTTP GET to HTTP POST (#522, #523, #524, #525, #526)
* Add support for the ApplicationConfiguration Setting (#521)
* Add support for the ActivationLockBypassCode Command (#578)
* Allow SCEP client validity to be adjusted via server startup flag (#577)
* Fix bug in mdmctl server saving, switch config when saving automatically (#565, #566)
@@ -37,7 +38,7 @@ Thanks to our contributors for this release: @erikng, @gerardkok, @knightsc, @ma
* Add device_information and security_info commands with curl API (#448)
* Add support for InstallEnterpriseApplication command (#452)
## [v1.3.0](https://github.com/micromdm/micromdm/compare/v1.2.0...v1.3.0)
## [v1.3.0](https://github.com/micromdm/micromdm/compare/v1.2.0...v1.3.0)
### Auto-assigner

View File

@@ -170,6 +170,7 @@ type Command struct {
// - DeviceConfigured
// - AvailableOSUpdates
// - NSExtensionMappings
// - ActivationLockBypassCode
//
// Types that are valid to be assigned to Request:
// *Command_InstallProfile

View File

@@ -28,6 +28,7 @@ message Command {
- DeviceConfigured
- AvailableOSUpdates
- NSExtensionMappings
- ActivationLockBypassCode
*/
oneof request {
InstallProfile install_profile = 2;
@@ -138,7 +139,7 @@ message EnableLostMode {
message InstallApplication {
int64 itunes_store_id = 1;
string identifier = 2;
InstallApplicationOptions options = 3;
InstallApplicationOptions options = 3;
string manifest_url = 4;
int64 management_flags = 5; // bitwise OR
InstallApplicationConfiguration configuration = 6;
@@ -163,7 +164,7 @@ message InstallEnterpriseApplication {
}
message Manifest {
repeated ManifestItem manifest_items = 1;
repeated ManifestItem manifest_items = 1;
}
message ManifestItem {
@@ -290,7 +291,7 @@ message ApplicationAttributesSetting {
message ApplicationConfigurationSetting {
string identifier = 1;
bytes configuration_dictionary_data = 2; // A serialized plist of the dictionary.
bytes configuration_dictionary_data = 2; // A serialized plist of the dictionary.
}
message ApplicationAttributes {
@@ -405,8 +406,8 @@ message ErrorChain {
string localized_description = 1;
string us_english_description = 2;
// The ErrorDomain and ErrorCode keys contain internal codes used by Apple
// that may be useful for diagnostics. Your host should not rely on these
// The ErrorDomain and ErrorCode keys contain internal codes used by Apple
// that may be useful for diagnostics. Your host should not rely on these
// values, as they may change between software releases.
string error_domain = 3;
int32 error_code = 4;

View File

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

View File

@@ -26,7 +26,8 @@ func (c *Command) MarshalPlist() (interface{}, error) {
"DeviceConfigured",
"AvailableOSUpdates",
"NSExtensionMappings",
"OSUpdateStatus":
"OSUpdateStatus",
"ActivationLockBypassCode":
return &struct {
RequestType string
}{

View File

@@ -42,7 +42,8 @@ func commandToProto(cmd *Command) (*mdmproto.Command, error) {
"DeviceConfigured",
"AvailableOSUpdates",
"NSExtensionMappings",
"OSUpdateStatus":
"OSUpdateStatus",
"ActivationLockBypassCode":
case "InstallProfile":
if cmd.InstallProfile == nil {

View File

@@ -47,7 +47,8 @@ func (c *Command) UnmarshalJSON(data []byte) error {
"DeviceConfigured",
"AvailableOSUpdates",
"NSExtensionMappings",
"OSUpdateStatus":
"OSUpdateStatus",
"ActivationLockBypassCode":
return nil
case "InstallProfile":
var payload InstallProfile

View File

@@ -33,7 +33,8 @@ func (c *Command) UnmarshalPlist(unmarshal func(i interface{}) error) error {
"DeviceConfigured",
"AvailableOSUpdates",
"NSExtensionMappings",
"OSUpdateStatus":
"OSUpdateStatus",
"ActivationLockBypassCode":
return nil
case "InstallProfile":
var payload InstallProfile

View File

@@ -27,7 +27,8 @@ func protoToCommand(pb *mdmproto.Command) *Command {
"DeviceConfigured",
"AvailableOSUpdates",
"NSExtensionMappings",
"OSUpdateStatus":
"OSUpdateStatus",
"ActivationLockBypassCode":
case "InstallProfile":
cmd.InstallProfile = &InstallProfile{

View File

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