Adds DisableAdvancedView optional MDM flag

This commit is contained in:
riccardom
2026-06-12 16:04:21 +02:00
parent d3f62458d2
commit aae6a924e2
6 changed files with 331 additions and 275 deletions

View File

@@ -15,6 +15,7 @@ var allKeys = []string{
KeyDisableUpdateSettings,
KeyDisableProfiles,
KeyDisableNetworks,
KeyDisableAdvancedView,
KeyDisableClientRoutes,
KeyDisableServerRoutes,
KeyBlockInbound,

View File

@@ -23,6 +23,13 @@ const (
KeyDisableUpdateSettings = "disableUpdateSettings"
KeyDisableProfiles = "disableProfiles"
KeyDisableNetworks = "disableNetworks"
// KeyDisableAdvancedView gates the advanced-view section in the
// upcoming UI revision. UI-only: NOT stored on Config, not
// applied by applyMDMPolicy, not rejectable via SetConfig. The
// daemon surfaces it through GetFeatures (tristate: present
// true / present false / absent) and the same key appears in
// GetConfigResponse.mDMManagedFields when set.
KeyDisableAdvancedView = "disableAdvancedView"
KeyDisableClientRoutes = "disableClientRoutes"
KeyDisableServerRoutes = "disableServerRoutes"
KeyBlockInbound = "blockInbound"

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.6
// protoc v3.21.12
// protoc v6.33.1
// source: daemon.proto
package proto
@@ -5035,8 +5035,14 @@ type GetFeaturesResponse struct {
DisableProfiles bool `protobuf:"varint,1,opt,name=disable_profiles,json=disableProfiles,proto3" json:"disable_profiles,omitempty"`
DisableUpdateSettings bool `protobuf:"varint,2,opt,name=disable_update_settings,json=disableUpdateSettings,proto3" json:"disable_update_settings,omitempty"`
DisableNetworks bool `protobuf:"varint,3,opt,name=disable_networks,json=disableNetworks,proto3" json:"disable_networks,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
// disableAdvancedView gates the upcoming UI revision's advanced
// section. Tristate: unset = no MDM directive, the UI applies its
// own default; true = MDM enforces disable; false = MDM enforces
// enable. Sourced exclusively from the MDM policy — no CLI /
// config flag backs this value.
DisableAdvancedView *bool `protobuf:"varint,4,opt,name=disable_advanced_view,json=disableAdvancedView,proto3,oneof" json:"disable_advanced_view,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *GetFeaturesResponse) Reset() {
@@ -5090,6 +5096,13 @@ func (x *GetFeaturesResponse) GetDisableNetworks() bool {
return false
}
func (x *GetFeaturesResponse) GetDisableAdvancedView() bool {
if x != nil && x.DisableAdvancedView != nil {
return *x.DisableAdvancedView
}
return false
}
// MDMManagedFieldsViolation is attached as a gRPC error detail on a
// FailedPrecondition status returned from SetConfig (and similar mutating
// RPCs) when the caller tries to modify one or more MDM-enforced fields.
@@ -7188,11 +7201,13 @@ const file_daemon_proto_rawDesc = "" +
"\f_profileNameB\v\n" +
"\t_username\"\x10\n" +
"\x0eLogoutResponse\"\x14\n" +
"\x12GetFeaturesRequest\"\xa3\x01\n" +
"\x12GetFeaturesRequest\"\xf6\x01\n" +
"\x13GetFeaturesResponse\x12)\n" +
"\x10disable_profiles\x18\x01 \x01(\bR\x0fdisableProfiles\x126\n" +
"\x17disable_update_settings\x18\x02 \x01(\bR\x15disableUpdateSettings\x12)\n" +
"\x10disable_networks\x18\x03 \x01(\bR\x0fdisableNetworks\"3\n" +
"\x10disable_networks\x18\x03 \x01(\bR\x0fdisableNetworks\x127\n" +
"\x15disable_advanced_view\x18\x04 \x01(\bH\x00R\x13disableAdvancedView\x88\x01\x01B\x18\n" +
"\x16_disable_advanced_view\"3\n" +
"\x19MDMManagedFieldsViolation\x12\x16\n" +
"\x06fields\x18\x01 \x03(\tR\x06fields\"\x16\n" +
"\x14TriggerUpdateRequest\"M\n" +
@@ -7642,6 +7657,7 @@ func file_daemon_proto_init() {
file_daemon_proto_msgTypes[56].OneofWrappers = []any{}
file_daemon_proto_msgTypes[58].OneofWrappers = []any{}
file_daemon_proto_msgTypes[69].OneofWrappers = []any{}
file_daemon_proto_msgTypes[72].OneofWrappers = []any{}
file_daemon_proto_msgTypes[78].OneofWrappers = []any{}
file_daemon_proto_msgTypes[82].OneofWrappers = []any{}
file_daemon_proto_msgTypes[95].OneofWrappers = []any{

View File

@@ -791,6 +791,12 @@ message GetFeaturesResponse{
bool disable_profiles = 1;
bool disable_update_settings = 2;
bool disable_networks = 3;
// disableAdvancedView gates the upcoming UI revision's advanced
// section. Tristate: unset = no MDM directive, the UI applies its
// own default; true = MDM enforces disable; false = MDM enforces
// enable. Sourced exclusively from the MDM policy — no CLI /
// config flag backs this value.
optional bool disable_advanced_view = 4;
}
// MDMManagedFieldsViolation is attached as a gRPC error detail on a

File diff suppressed because it is too large Load Diff

View File

@@ -2115,11 +2115,27 @@ func (s *Server) GetFeatures(ctx context.Context, msg *proto.GetFeaturesRequest)
DisableProfiles: s.checkProfilesDisabled(),
DisableUpdateSettings: s.checkUpdateSettingsDisabled(),
DisableNetworks: s.checkNetworksDisabled(),
DisableAdvancedView: s.checkDisableAdvancedView(),
}
return features, nil
}
// checkDisableAdvancedView reports the MDM-policy directive for the
// upcoming UI's advanced-view section. Tristate: returns nil when no
// MDM directive is set so the UI applies its own default; returns
// &true / &false when MDM explicitly enforces. No CLI flag backs
// this feature — MDM is the sole source.
func (s *Server) checkDisableAdvancedView() *bool {
if s.config == nil {
return nil
}
if v, ok := s.config.Policy().GetBool(mdm.KeyDisableAdvancedView); ok {
return &v
}
return nil
}
func (s *Server) connect(ctx context.Context, config *profilemanager.Config, statusRecorder *peer.Status, runningChan chan struct{}) error {
log.Tracef("running client connection")
client := internal.NewConnectClient(ctx, config, statusRecorder)