Add new configuration option to set default team for Apple Business Manager#9062
Conversation
6120d1b to
c1f12fd
Compare
There was a problem hiding this comment.
Ah, sorry there's been a misunderstanding here - the default team should be provided as part of the API call that is done by client.GetAppleBM() above (line 1119), so there wouldn't be any change needed here. The default team is part of the response payload returned by GET /api/v1/fleet/mdm/apple_bm.
There was a problem hiding this comment.
This is where it should be set: https://github.com/fleetdm/fleet/blob/main/ee/server/service/mdm.go#L43-L45
There was a problem hiding this comment.
Let's leave a comment in AppConfig.Clone to indicate that this settings sub-section does not require any cloning (it helps see that this was not forgotten, but nothing specific needed to be done).
There was a problem hiding this comment.
This would trigger the team lookup and validation every time the app config is modified, if there is a default team. It would be best to do it only if the request actually changes the value. You can see some examples in this function that compares the original value vs the new one, it can be used to decide if validation should be triggered. And I think the license check could be done before validating too, so that if we end up removing the default team due to the license, we don't validate the team name for nothing.
There was a problem hiding this comment.
We should have some tests too around that - call with free license + a team ensuring that it doesn't set one, and premium and invalid team/valid team. Probably at the integration level would make sense (there's TestAppConfig in integration_core_test.go for the free license, and TestCustomTransparencyURL in integration_enterprise_test.go can serve as inspiration for premium license tests).
chris-mcgillicuddy
left a comment
There was a problem hiding this comment.
A few suggestions for your review, @fx5.
2e7ffb3 to
9773595
Compare
9773595 to
665f2a2
Compare
Codecov ReportBase: 60.25% // Head: 59.80% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #9062 +/- ##
==========================================
- Coverage 60.25% 59.80% -0.45%
==========================================
Files 473 473
Lines 46063 46655 +592
==========================================
+ Hits 27754 27902 +148
- Misses 15705 16143 +438
- Partials 2604 2610 +6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Co-authored-by: Chris McGillicuddy <108031970+chris-mcgillicuddy@users.noreply.github.com>
Co-authored-by: Chris McGillicuddy <108031970+chris-mcgillicuddy@users.noreply.github.com>
f4de47b to
995c28b
Compare
|
A heads-up that I have a PR based off this branch to use the setting introduced here in order to make the team assignment when a device is enrolled: #9135 |
For #8733
Changes file added for user-visible changes in
changes/ororbit/changes/.See Changes files for more information.
Documented any API changes (docs/Using-Fleet/REST-API.md or docs/Contributing/API-for-contributors.md)
Manual QA for all new/changed functionality