From 7a3eac3dcddefac4efb9440a6e197cf35e53e487 Mon Sep 17 00:00:00 2001 From: Pascal Fischer Date: Sun, 6 Oct 2024 16:20:46 +0200 Subject: [PATCH 1/2] remove admin check on getAccountByID --- management/server/account.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/management/server/account.go b/management/server/account.go index a9781b385a8..50aeb82e019 100644 --- a/management/server/account.go +++ b/management/server/account.go @@ -18,7 +18,6 @@ import ( "github.com/eko/gocache/v3/cache" cacheStore "github.com/eko/gocache/v3/store" - "github.com/hashicorp/go-multierror" "github.com/miekg/dns" "github.com/netbirdio/netbird/base62" nbdns "github.com/netbirdio/netbird/dns" @@ -1764,7 +1763,7 @@ func (am *DefaultAccountManager) GetAccountByID(ctx context.Context, accountID s return nil, err } - if user.AccountID != accountID || (!user.HasAdminPower() && !user.IsServiceUser) { + if user.AccountID != accountID { return nil, status.Errorf(status.PermissionDenied, "the user has no permission to access account data") } From a4b7dd23963ee9bd0c4245deb4fac63319c364fa Mon Sep 17 00:00:00 2001 From: Pascal Fischer Date: Sun, 6 Oct 2024 16:38:52 +0200 Subject: [PATCH 2/2] fix imports --- management/server/account.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/management/server/account.go b/management/server/account.go index 50aeb82e019..6ee0015f86f 100644 --- a/management/server/account.go +++ b/management/server/account.go @@ -18,7 +18,13 @@ import ( "github.com/eko/gocache/v3/cache" cacheStore "github.com/eko/gocache/v3/store" + "github.com/hashicorp/go-multierror" "github.com/miekg/dns" + gocache "github.com/patrickmn/go-cache" + "github.com/rs/xid" + log "github.com/sirupsen/logrus" + "golang.org/x/exp/maps" + "github.com/netbirdio/netbird/base62" nbdns "github.com/netbirdio/netbird/dns" "github.com/netbirdio/netbird/management/domain" @@ -35,10 +41,6 @@ import ( "github.com/netbirdio/netbird/management/server/status" "github.com/netbirdio/netbird/management/server/telemetry" "github.com/netbirdio/netbird/route" - gocache "github.com/patrickmn/go-cache" - "github.com/rs/xid" - log "github.com/sirupsen/logrus" - "golang.org/x/exp/maps" ) const (