Skip to content

Commit

Permalink
[management] Remove admin check on getAccountByID (#2699)
Browse files Browse the repository at this point in the history
  • Loading branch information
pascal-fischer authored Oct 6, 2024
1 parent f603cd9 commit dbec24b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions management/server/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ import (
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"
Expand All @@ -36,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 (
Expand Down Expand Up @@ -1764,7 +1765,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")
}

Expand Down

0 comments on commit dbec24b

Please sign in to comment.