mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 13:37:30 +00:00
Fixed a server panic when uploading an MDM profile to a team on a free license (#42834)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #41484 # Checklist for submitter - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. ## Testing - [x] QA'd all new/changed functionality manually <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Fixed a server crash that occurred when uploading a Windows MDM profile to a team on a free license. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
226df9277c
commit
667bac8cb8
3 changed files with 12 additions and 1 deletions
1
changes/41484-fix-windows-mdm-profile-upload-panic
Normal file
1
changes/41484-fix-windows-mdm-profile-upload-panic
Normal file
|
|
@ -0,0 +1 @@
|
|||
- Fixed a server panic when uploading a Windows MDM profile to a team on a free license.
|
||||
|
|
@ -33,6 +33,7 @@ import (
|
|||
"github.com/fleetdm/fleet/v4/server/authz"
|
||||
"github.com/fleetdm/fleet/v4/server/config"
|
||||
"github.com/fleetdm/fleet/v4/server/contexts/ctxerr"
|
||||
"github.com/fleetdm/fleet/v4/server/contexts/license"
|
||||
"github.com/fleetdm/fleet/v4/server/contexts/logging"
|
||||
"github.com/fleetdm/fleet/v4/server/contexts/viewer"
|
||||
"github.com/fleetdm/fleet/v4/server/fleet"
|
||||
|
|
@ -364,7 +365,11 @@ func (svc *Service) NewMDMAppleConfigProfile(ctx context.Context, teamID uint, d
|
|||
}
|
||||
|
||||
var teamName string
|
||||
if teamID >= 1 {
|
||||
if teamID > 0 {
|
||||
lic, _ := license.FromContext(ctx)
|
||||
if lic == nil || !lic.IsPremium() {
|
||||
return nil, ctxerr.Wrap(ctx, fleet.ErrMissingLicense)
|
||||
}
|
||||
tm, err := svc.EnterpriseOverrides.TeamByIDOrName(ctx, &teamID, nil)
|
||||
if err != nil {
|
||||
return nil, ctxerr.Wrap(ctx, err)
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import (
|
|||
|
||||
"github.com/fleetdm/fleet/v4/server/authz"
|
||||
"github.com/fleetdm/fleet/v4/server/contexts/ctxerr"
|
||||
"github.com/fleetdm/fleet/v4/server/contexts/license"
|
||||
"github.com/fleetdm/fleet/v4/server/fleet"
|
||||
"github.com/fleetdm/fleet/v4/server/mdm/microsoft/syncml"
|
||||
"github.com/fleetdm/fleet/v4/server/platform/endpointer"
|
||||
|
|
@ -33,6 +34,10 @@ func (svc *Service) NewMDMWindowsConfigProfile(ctx context.Context, teamID uint,
|
|||
|
||||
var teamName string
|
||||
if teamID > 0 {
|
||||
lic, _ := license.FromContext(ctx)
|
||||
if lic == nil || !lic.IsPremium() {
|
||||
return nil, ctxerr.Wrap(ctx, fleet.ErrMissingLicense)
|
||||
}
|
||||
tm, err := svc.EnterpriseOverrides.TeamByIDOrName(ctx, &teamID, nil)
|
||||
if err != nil {
|
||||
return nil, ctxerr.Wrap(ctx, err)
|
||||
|
|
|
|||
Loading…
Reference in a new issue