mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 01:18:42 +00:00
Filter removed mdm profiles from host details (#10074)
This commit is contained in:
parent
16a724f067
commit
5a988872a7
2 changed files with 7 additions and 2 deletions
|
|
@ -141,7 +141,7 @@ func (ds *Datastore) DeleteMDMAppleConfigProfile(ctx context.Context, profileID
|
|||
}
|
||||
|
||||
func (ds *Datastore) GetHostMDMProfiles(ctx context.Context, hostUUID string) ([]fleet.HostMDMAppleProfile, error) {
|
||||
stmt := `
|
||||
stmt := fmt.Sprintf(`
|
||||
SELECT
|
||||
hmap.profile_id,
|
||||
name,
|
||||
|
|
@ -154,7 +154,10 @@ FROM
|
|||
JOIN
|
||||
mdm_apple_configuration_profiles hmacp ON hmap.profile_id = hmacp.profile_id
|
||||
WHERE
|
||||
host_uuid = ?`
|
||||
host_uuid = ? AND NOT (operation_type = '%s' AND status = '%s')`,
|
||||
fleet.MDMAppleOperationTypeRemove,
|
||||
fleet.MDMAppleDeliveryApplied,
|
||||
)
|
||||
|
||||
var profiles []fleet.HostMDMAppleProfile
|
||||
if err := sqlx.SelectContext(ctx, ds.reader, &profiles, stmt, hostUUID); err != nil {
|
||||
|
|
|
|||
|
|
@ -422,6 +422,8 @@ func (s *integrationMDMTestSuite) TestProfileManagement() {
|
|||
var res getHostResponse
|
||||
s.DoJSON("GET", fmt.Sprintf("/api/v1/fleet/hosts/%d", host.ID), getHostRequest{}, http.StatusOK, &res)
|
||||
require.NotEmpty(t, res.Host.MDM.Profiles)
|
||||
resProfiles := *res.Host.MDM.Profiles
|
||||
require.Len(t, resProfiles, len(teamProfiles))
|
||||
}
|
||||
|
||||
func (s *integrationMDMTestSuite) TestDEPProfileAssignment() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue