diff --git a/go.mod b/go.mod index 44d7cd6ec..cb8310dfb 100644 --- a/go.mod +++ b/go.mod @@ -51,7 +51,7 @@ require ( github.com/miekg/dns v1.1.43 github.com/mitchellh/hashstructure/v2 v2.0.2 github.com/nadoo/ipset v0.5.0 - github.com/netbirdio/management-integrations/integrations v0.0.0-20231128110844-6dc8ff1bf262 + github.com/netbirdio/management-integrations/integrations v0.0.0-20231128134945-092a9f4a2d06 github.com/okta/okta-sdk-golang/v2 v2.18.0 github.com/patrickmn/go-cache v2.1.0+incompatible github.com/pion/logging v0.2.2 diff --git a/go.sum b/go.sum index 4038f9b5f..5dcc3a776 100644 --- a/go.sum +++ b/go.sum @@ -509,6 +509,10 @@ github.com/netbirdio/management-integrations/integrations v0.0.0-20231128103220- github.com/netbirdio/management-integrations/integrations v0.0.0-20231128103220-a3b41e63c818/go.mod h1:aRyvEvLzMX9+eDgW+cMRh0CkxR8sYIszmEITaWFZ5Vc= github.com/netbirdio/management-integrations/integrations v0.0.0-20231128110844-6dc8ff1bf262 h1:JVImKBfZC2tC88GcJS0Hi6sdFL+FkhCcmbpU8lRAWss= github.com/netbirdio/management-integrations/integrations v0.0.0-20231128110844-6dc8ff1bf262/go.mod h1:aRyvEvLzMX9+eDgW+cMRh0CkxR8sYIszmEITaWFZ5Vc= +github.com/netbirdio/management-integrations/integrations v0.0.0-20231128134203-547db8103a27 h1:cxyRuXtsr20HTz2YAcxpc+I1xVLLuIAxv8HpCs8Q5v4= +github.com/netbirdio/management-integrations/integrations v0.0.0-20231128134203-547db8103a27/go.mod h1:eRv50kd3bXd2y59HK3OY4RI8YUL0JEN290D5dqW4llY= +github.com/netbirdio/management-integrations/integrations v0.0.0-20231128134945-092a9f4a2d06 h1:hEgJwiJTT/b0s3RNkXFpe2hTFu5rZJfHxd8UyuyRz/0= +github.com/netbirdio/management-integrations/integrations v0.0.0-20231128134945-092a9f4a2d06/go.mod h1:eRv50kd3bXd2y59HK3OY4RI8YUL0JEN290D5dqW4llY= github.com/netbirdio/service v0.0.0-20230215170314-b923b89432b0 h1:hirFRfx3grVA/9eEyjME5/z3nxdJlN9kfQpvWWPk32g= github.com/netbirdio/service v0.0.0-20230215170314-b923b89432b0/go.mod h1:CIMRFEJVL+0DS1a3Nx06NaMn4Dz63Ng6O7dl0qH0zVM= github.com/netbirdio/systray v0.0.0-20231030152038-ef1ed2a27949 h1:xbWM9BU6mwZZLHxEjxIX/V8Hv3HurQt4mReIE4mY4DM= diff --git a/management/server/account.go b/management/server/account.go index 12198d726..e4af8e8f6 100644 --- a/management/server/account.go +++ b/management/server/account.go @@ -360,14 +360,14 @@ func (a *Account) GetPeerNetworkMap(peerID, dnsDomain string) *NetworkMap { Network: a.Network.Copy(), } } - validatedPeers := integrations.ValidatePeers([]*nbpeer.Peer{peer}, a) + validatedPeers := integrations.ValidatePeers([]*nbpeer.Peer{peer}) if len(validatedPeers) == 0 { return &NetworkMap{ Network: a.Network.Copy(), } } aclPeers, firewallRules := a.getPeerConnectionResources(peerID) - aclPeers = integrations.ValidatePeers(aclPeers, a) + aclPeers = integrations.ValidatePeers(aclPeers) // exclude expired peers var peersToConnect []*nbpeer.Peer var expiredPeers []*nbpeer.Peer @@ -894,7 +894,7 @@ func (am *DefaultAccountManager) UpdateAccountSettings(accountID, userID string, return nil, err } - err = integrations.ValidateExtraSettings(newSettings.Extra, account, userID, am) + err = integrations.ValidateExtraSettings(newSettings.Extra, account.Settings.Extra, account.Peers, userID, accountID, am.eventStore) if err != nil { return nil, err } diff --git a/management/server/peer.go b/management/server/peer.go index 97cada4f0..b42615d12 100644 --- a/management/server/peer.go +++ b/management/server/peer.go @@ -143,7 +143,7 @@ func (am *DefaultAccountManager) UpdatePeer(accountID, userID string, update *nb return nil, status.Errorf(status.NotFound, "peer %s not found", update.ID) } - update, err = integrations.ValidatePeersUpdateRequest(update, peer, am) + update, err = integrations.ValidatePeersUpdateRequest(update, peer, userID, am.eventStore, am.GetDNSDomain()) if err != nil { return nil, err } @@ -480,7 +480,7 @@ func (am *DefaultAccountManager) SyncPeer(sync PeerSync) (*nbpeer.Peer, *Network return nil, nil, status.Errorf(status.Unauthenticated, "peer is not registered") } - validatedPeers := integrations.ValidatePeers([]*nbpeer.Peer{peer}, account) + validatedPeers := integrations.ValidatePeers([]*nbpeer.Peer{peer}) if len(validatedPeers) == 0 { return nil, nil, status.Errorf(status.PermissionDenied, "peer validation failed") }