mirror of
https://github.com/micromdm/micromdm/
synced 2026-08-10 11:36:06 +08:00
add profiles to response
This commit is contained in:
@@ -9,9 +9,9 @@ import (
|
||||
|
||||
// Profile is a configuration profile
|
||||
type Profile struct {
|
||||
UUID string `plist:"-" json:"profile_uuid" db:"profile_uuid"`
|
||||
UUID string `plist:"-" json:"profile_uuid,omitempty" db:"profile_uuid"`
|
||||
PayloadIdentifier string `json:"payload_identifier" db:"identifier"`
|
||||
Data string `json:"data" db:"data"`
|
||||
Data string `json:"data,omitempty" db:"data"`
|
||||
}
|
||||
|
||||
// Logger adds a logger to the database config
|
||||
|
||||
@@ -36,10 +36,16 @@ func (svc workflowService) CreateWorkflow(wfRequest *Workflow) (*Workflow, error
|
||||
}
|
||||
// if this loop fails the workflow already exists
|
||||
// need to delete the workflow? ugh
|
||||
// also, the PayloadIdentifier is not validated
|
||||
// it should be
|
||||
for _, pf := range wfRequest.Profiles {
|
||||
if err := svc.db.AddProfile(wf.UUID, pf.UUID); err != nil {
|
||||
return nil, errors.Wrap(err, "createworkflow failed to add profile")
|
||||
}
|
||||
wf.Profiles = append(wf.Profiles, configProfile{
|
||||
UUID: pf.UUID,
|
||||
PayloadIdentifier: pf.PayloadIdentifier,
|
||||
})
|
||||
}
|
||||
return wf, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user