mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-18 16:26:38 +00:00
minor changes
This commit is contained in:
@@ -1194,7 +1194,6 @@ func (s *SqlStore) getAccount(ctx context.Context, accountID string) (*types.Acc
|
|||||||
settings_extra_integrated_validator, settings_extra_integrated_validator_groups
|
settings_extra_integrated_validator, settings_extra_integrated_validator_groups
|
||||||
FROM accounts WHERE id = $1`
|
FROM accounts WHERE id = $1`
|
||||||
|
|
||||||
var networkNet, dnsSettingsDisabledGroups []byte
|
|
||||||
var (
|
var (
|
||||||
sPeerLoginExpirationEnabled sql.NullBool
|
sPeerLoginExpirationEnabled sql.NullBool
|
||||||
sPeerLoginExpiration sql.NullInt64
|
sPeerLoginExpiration sql.NullInt64
|
||||||
@@ -1204,20 +1203,24 @@ func (s *SqlStore) getAccount(ctx context.Context, accountID string) (*types.Acc
|
|||||||
sGroupsPropagationEnabled sql.NullBool
|
sGroupsPropagationEnabled sql.NullBool
|
||||||
sJWTGroupsEnabled sql.NullBool
|
sJWTGroupsEnabled sql.NullBool
|
||||||
sJWTGroupsClaimName sql.NullString
|
sJWTGroupsClaimName sql.NullString
|
||||||
sJWTAllowGroups []byte
|
sJWTAllowGroups sql.NullString
|
||||||
sRoutingPeerDNSResolutionEnabled sql.NullBool
|
sRoutingPeerDNSResolutionEnabled sql.NullBool
|
||||||
sDNSDomain sql.NullString
|
sDNSDomain sql.NullString
|
||||||
sNetworkRange []byte
|
sNetworkRange sql.NullString
|
||||||
sLazyConnectionEnabled sql.NullBool
|
sLazyConnectionEnabled sql.NullBool
|
||||||
sExtraPeerApprovalEnabled sql.NullBool
|
sExtraPeerApprovalEnabled sql.NullBool
|
||||||
sExtraUserApprovalRequired sql.NullBool
|
sExtraUserApprovalRequired sql.NullBool
|
||||||
sExtraIntegratedValidator sql.NullString
|
sExtraIntegratedValidator sql.NullString
|
||||||
sExtraIntegratedValidatorGroups []byte
|
sExtraIntegratedValidatorGroups sql.NullString
|
||||||
|
networkNet sql.NullString
|
||||||
|
dnsSettingsDisabledGroups sql.NullString
|
||||||
|
networkIdentifier sql.NullString
|
||||||
|
networkDns sql.NullString
|
||||||
|
networkSerial sql.NullInt64
|
||||||
)
|
)
|
||||||
|
|
||||||
err := s.pool.QueryRow(ctx, accountQuery, accountID).Scan(
|
err := s.pool.QueryRow(ctx, accountQuery, accountID).Scan(
|
||||||
&account.Id, &account.CreatedBy, &account.CreatedAt, &account.Domain, &account.DomainCategory, &account.IsDomainPrimaryAccount,
|
&account.Id, &account.CreatedBy, &account.CreatedAt, &account.Domain, &account.DomainCategory, &account.IsDomainPrimaryAccount,
|
||||||
&account.Network.Identifier, &networkNet, &account.Network.Dns, &account.Network.Serial,
|
&networkIdentifier, &networkNet, &networkDns, &networkSerial,
|
||||||
&dnsSettingsDisabledGroups,
|
&dnsSettingsDisabledGroups,
|
||||||
&sPeerLoginExpirationEnabled, &sPeerLoginExpiration,
|
&sPeerLoginExpirationEnabled, &sPeerLoginExpiration,
|
||||||
&sPeerInactivityExpirationEnabled, &sPeerInactivityExpiration,
|
&sPeerInactivityExpirationEnabled, &sPeerInactivityExpiration,
|
||||||
@@ -1235,10 +1238,22 @@ func (s *SqlStore) getAccount(ctx context.Context, accountID string) (*types.Acc
|
|||||||
return nil, status.NewGetAccountFromStoreError(err)
|
return nil, status.NewGetAccountFromStoreError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = json.Unmarshal(networkNet, &account.Network.Net)
|
|
||||||
_ = json.Unmarshal(dnsSettingsDisabledGroups, &account.DNSSettings.DisabledManagementGroups)
|
|
||||||
|
|
||||||
account.Settings = &types.Settings{Extra: &types.ExtraSettings{}}
|
account.Settings = &types.Settings{Extra: &types.ExtraSettings{}}
|
||||||
|
if networkNet.Valid {
|
||||||
|
_ = json.Unmarshal([]byte(networkNet.String), &account.Network.Net)
|
||||||
|
}
|
||||||
|
if dnsSettingsDisabledGroups.Valid {
|
||||||
|
_ = json.Unmarshal([]byte(dnsSettingsDisabledGroups.String), &account.DNSSettings.DisabledManagementGroups)
|
||||||
|
}
|
||||||
|
if networkIdentifier.Valid {
|
||||||
|
account.Network.Identifier = networkIdentifier.String
|
||||||
|
}
|
||||||
|
if networkDns.Valid {
|
||||||
|
account.Network.Dns = networkDns.String
|
||||||
|
}
|
||||||
|
if networkSerial.Valid {
|
||||||
|
account.Network.Serial = uint64(networkSerial.Int64)
|
||||||
|
}
|
||||||
if sPeerLoginExpirationEnabled.Valid {
|
if sPeerLoginExpirationEnabled.Valid {
|
||||||
account.Settings.PeerLoginExpirationEnabled = sPeerLoginExpirationEnabled.Bool
|
account.Settings.PeerLoginExpirationEnabled = sPeerLoginExpirationEnabled.Bool
|
||||||
}
|
}
|
||||||
@@ -1272,11 +1287,11 @@ func (s *SqlStore) getAccount(ctx context.Context, accountID string) (*types.Acc
|
|||||||
if sLazyConnectionEnabled.Valid {
|
if sLazyConnectionEnabled.Valid {
|
||||||
account.Settings.LazyConnectionEnabled = sLazyConnectionEnabled.Bool
|
account.Settings.LazyConnectionEnabled = sLazyConnectionEnabled.Bool
|
||||||
}
|
}
|
||||||
if sJWTAllowGroups != nil {
|
if sJWTAllowGroups.Valid {
|
||||||
_ = json.Unmarshal(sJWTAllowGroups, &account.Settings.JWTAllowGroups)
|
_ = json.Unmarshal([]byte(sJWTAllowGroups.String), &account.Settings.JWTAllowGroups)
|
||||||
}
|
}
|
||||||
if sNetworkRange != nil {
|
if sNetworkRange.Valid {
|
||||||
_ = json.Unmarshal(sNetworkRange, &account.Settings.NetworkRange)
|
_ = json.Unmarshal([]byte(sNetworkRange.String), &account.Settings.NetworkRange)
|
||||||
}
|
}
|
||||||
|
|
||||||
if sExtraPeerApprovalEnabled.Valid {
|
if sExtraPeerApprovalEnabled.Valid {
|
||||||
@@ -1288,8 +1303,8 @@ func (s *SqlStore) getAccount(ctx context.Context, accountID string) (*types.Acc
|
|||||||
if sExtraIntegratedValidator.Valid {
|
if sExtraIntegratedValidator.Valid {
|
||||||
account.Settings.Extra.IntegratedValidator = sExtraIntegratedValidator.String
|
account.Settings.Extra.IntegratedValidator = sExtraIntegratedValidator.String
|
||||||
}
|
}
|
||||||
if sExtraIntegratedValidatorGroups != nil {
|
if sExtraIntegratedValidatorGroups.Valid {
|
||||||
_ = json.Unmarshal(sExtraIntegratedValidatorGroups, &account.Settings.Extra.IntegratedValidatorGroups)
|
_ = json.Unmarshal([]byte(sExtraIntegratedValidatorGroups.String), &account.Settings.Extra.IntegratedValidatorGroups)
|
||||||
}
|
}
|
||||||
return &account, nil
|
return &account, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user