mirror of
https://github.com/micromdm/micromdm/
synced 2026-08-12 13:25:38 +08:00
Set LastQueryResponse to byte slice.
Marshal LastQueryResponse to JSON in connect.Service
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package connect
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/micromdm/mdm"
|
||||
"github.com/micromdm/micromdm/command"
|
||||
"github.com/micromdm/micromdm/device"
|
||||
@@ -89,7 +90,11 @@ func (svc service) ackQueryResponses(req mdm.Response) error {
|
||||
|
||||
now := time.Now()
|
||||
existing.LastCheckin = &now
|
||||
existing.LastQueryResponse = req.QueryResponses
|
||||
existing.LastQueryResponse, err = json.Marshal(req.QueryResponses)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
existing.ProductName = req.QueryResponses.ProductName
|
||||
existing.BuildVersion = req.QueryResponses.BuildVersion
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/micromdm/dep"
|
||||
"github.com/micromdm/mdm"
|
||||
//"github.com/micromdm/mdm"
|
||||
)
|
||||
|
||||
// Device represents an iOS or OS X Computer
|
||||
@@ -21,27 +21,27 @@ type Device struct {
|
||||
IMEI string `json:"imei,omitempty" db:"imei,omitempty"`
|
||||
MEID string `json:"meid,omitempty" db:"meid,omitempty"`
|
||||
//Apple MDM Protocol Topic
|
||||
MDMTopic string `json:"mdm_topic,omitempty" db:"apple_mdm_topic,omitempty"`
|
||||
PushMagic string `json:"push_magic,omitempty" db:"apple_push_magic,omitempty"`
|
||||
AwaitingConfiguration bool `json:"awaiting_configuration,omitempty" db:"awaiting_configuration,omitempty"`
|
||||
Token string `json:"token,omitempty" db:"apple_mdm_token,omitempty"`
|
||||
UnlockToken string `json:"unlock_token,omitempty" db:"unlock_token,omitempty"`
|
||||
Enrolled bool `json:"enrolled,omitempty" db:"mdm_enrolled,omitempty"`
|
||||
Workflow string `json:"workflow_uuid,omitempty" db:"workflow_uuid,omitempty"`
|
||||
DEPDevice bool `json:"dep_device,omitempty" db:"dep_device,omitempty"`
|
||||
Description string `json:"description,omitempty" db:"description"`
|
||||
Model string `json:"model,omitempty" db:"model"`
|
||||
Color string `json:"color,omitempty" db:"color"`
|
||||
AssetTag string `json:"asset_tag,omitempty" db:"asset_tag"`
|
||||
DEPProfileStatus DEPProfileStatus `json:"dep_profile_status,omitempty" db:"dep_profile_status"`
|
||||
DEPProfileUUID string `json:"dep_profile_uuid,omitempty" db:"dep_profile_uuid"`
|
||||
DEPProfileAssignTime *time.Time `json:"dep_profile_assign_time,omitempty" db:"dep_profile_assign_time"`
|
||||
DEPProfilePushTime *time.Time `json:"dep_profile_push_time,omitempty" db:"dep_profile_push_time"`
|
||||
DEPProfileAssignedDate *time.Time `json:"dep_profile_assigned_date,omitempty" db:"dep_profile_assigned_date"`
|
||||
DEPProfileAssignedBy string `json:"dep_profile_assigned_by,omitempty" db:"dep_profile_assigned_by"`
|
||||
LastCheckin *time.Time `json:"last_checkin" db:"last_checkin"`
|
||||
DeviceName string `json:"device_name" db:"device_name"`
|
||||
LastQueryResponse mdm.QueryResponses `json:"last_query_response" db:"last_query_response"`
|
||||
MDMTopic string `json:"mdm_topic,omitempty" db:"apple_mdm_topic,omitempty"`
|
||||
PushMagic string `json:"push_magic,omitempty" db:"apple_push_magic,omitempty"`
|
||||
AwaitingConfiguration bool `json:"awaiting_configuration,omitempty" db:"awaiting_configuration,omitempty"`
|
||||
Token string `json:"token,omitempty" db:"apple_mdm_token,omitempty"`
|
||||
UnlockToken string `json:"unlock_token,omitempty" db:"unlock_token,omitempty"`
|
||||
Enrolled bool `json:"enrolled,omitempty" db:"mdm_enrolled,omitempty"`
|
||||
Workflow string `json:"workflow_uuid,omitempty" db:"workflow_uuid,omitempty"`
|
||||
DEPDevice bool `json:"dep_device,omitempty" db:"dep_device,omitempty"`
|
||||
Description string `json:"description,omitempty" db:"description"`
|
||||
Model string `json:"model,omitempty" db:"model"`
|
||||
Color string `json:"color,omitempty" db:"color"`
|
||||
AssetTag string `json:"asset_tag,omitempty" db:"asset_tag"`
|
||||
DEPProfileStatus DEPProfileStatus `json:"dep_profile_status,omitempty" db:"dep_profile_status"`
|
||||
DEPProfileUUID string `json:"dep_profile_uuid,omitempty" db:"dep_profile_uuid"`
|
||||
DEPProfileAssignTime *time.Time `json:"dep_profile_assign_time,omitempty" db:"dep_profile_assign_time"`
|
||||
DEPProfilePushTime *time.Time `json:"dep_profile_push_time,omitempty" db:"dep_profile_push_time"`
|
||||
DEPProfileAssignedDate *time.Time `json:"dep_profile_assigned_date,omitempty" db:"dep_profile_assigned_date"`
|
||||
DEPProfileAssignedBy string `json:"dep_profile_assigned_by,omitempty" db:"dep_profile_assigned_by"`
|
||||
LastCheckin *time.Time `json:"last_checkin" db:"last_checkin"`
|
||||
DeviceName string `json:"device_name" db:"device_name"`
|
||||
LastQueryResponse []byte `json:"last_query_response" db:"last_query_response"`
|
||||
}
|
||||
|
||||
// DEPProfileStatus is the status of the DEP Profile
|
||||
|
||||
Reference in New Issue
Block a user