mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-31 03:51:29 +02:00
fix(ui): resolve active profile before GetConfig in GetRestrictions
GetRestrictions called the daemon GetConfig with an empty
GetConfigRequest, which the daemon has rejected since multi-profile
support landed ("active profile name is empty") because it reads the
profile name from the request. Resolve the active profile via
GetActiveProfile first and pass its name/username, mirroring the
working Settings.GetConfig path. GetActiveProfile self-heals to the
default profile, so a valid name is always supplied; the
profile-switch-disabled MDM flag is orthogonal and unaffected.
This commit is contained in:
@@ -4,6 +4,7 @@ package services
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/netbirdio/netbird/client/proto"
|
||||
@@ -200,7 +201,14 @@ func (s *Settings) GetRestrictions(ctx context.Context) (Restrictions, error) {
|
||||
if err != nil {
|
||||
return Restrictions{}, err
|
||||
}
|
||||
cfgResp, err := cli.GetConfig(ctx, &proto.GetConfigRequest{})
|
||||
active, err := cli.GetActiveProfile(ctx, &proto.GetActiveProfileRequest{})
|
||||
if err != nil {
|
||||
return Restrictions{}, fmt.Errorf("get active profile: %w", err)
|
||||
}
|
||||
cfgResp, err := cli.GetConfig(ctx, &proto.GetConfigRequest{
|
||||
ProfileName: active.GetProfileName(),
|
||||
Username: active.GetUsername(),
|
||||
})
|
||||
if err != nil {
|
||||
return Restrictions{}, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user