mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-21 06:09:07 +02:00
Fix status and list profiles
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"github.com/netbirdio/netbird/client/proto"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
@@ -47,14 +48,17 @@ func (g *AuthzGate) state() DaemonState {
|
||||
// RequireHolderForFullStatus escalates a StatusRequest that asks for peer detail
|
||||
// or for probes to be run.
|
||||
func RequireHolderForFullStatus(r Request) error {
|
||||
statusReq, ok := r.Msg.(interface {
|
||||
GetGetFullPeerStatus() bool
|
||||
GetShouldRunProbes() bool
|
||||
})
|
||||
statusReq, ok := r.Msg.(*proto.StatusRequest)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
if !statusReq.GetGetFullPeerStatus() && !statusReq.GetShouldRunProbes() {
|
||||
if r.Level < AuthzLevelSessionHolder {
|
||||
if statusReq.GetFullPeerStatus {
|
||||
statusReq.GetFullPeerStatus = false
|
||||
}
|
||||
if statusReq.ShouldRunProbes {
|
||||
statusReq.ShouldRunProbes = false
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return RequireLevel(AuthzLevelSessionHolder)(r)
|
||||
|
||||
@@ -48,6 +48,7 @@ var methodPolicies = map[string]MethodPolicy{
|
||||
// Any identified caller.
|
||||
servicePath + "Status": {Level: AuthzLevelIdentified, Rules: []Rule{RequireHolderForFullStatus}},
|
||||
servicePath + "AddProfile": {Level: AuthzLevelIdentified, Audit: true},
|
||||
servicePath + "ListProfiles": {Level: AuthzLevelIdentified},
|
||||
servicePath + "GetActiveProfile": {Level: AuthzLevelIdentified},
|
||||
servicePath + "GetFeatures": {Level: AuthzLevelIdentified},
|
||||
servicePath + "WailsUIReady": {Level: AuthzLevelIdentified},
|
||||
@@ -67,7 +68,6 @@ var methodPolicies = map[string]MethodPolicy{
|
||||
servicePath + "SwitchProfile": {Level: AuthzLevelSessionHolder, TargetsProfile: true, Audit: true},
|
||||
|
||||
// Owner of some profile
|
||||
servicePath + "ListProfiles": {Level: AuthzLevelProfileOwner},
|
||||
servicePath + "GetLogLevel": {Level: AuthzLevelProfileOwner},
|
||||
servicePath + "ListStates": {Level: AuthzLevelProfileOwner},
|
||||
servicePath + "GetInstallerResult": {Level: AuthzLevelProfileOwner},
|
||||
|
||||
Reference in New Issue
Block a user