[MM-68102] Add Classification Markings admin console page (#35934)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: David Krauser <david@krauser.org>
Co-authored-by: avasconcelos114 <andre.onogoro@gmail.com>
This commit is contained in:
David Krauser
2026-04-28 20:02:41 +00:00
committed by GitHub
co-authored by Claude Opus 4.6 avasconcelos114
parent fdaea9dec3
commit 2b7b398a22
32 changed files with 2845 additions and 10 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ const maxPropertyValuePatchItems = 50
func (api *API) InitProperties() {
api.BaseRoutes.PropertyFields.Handle("", api.APISessionRequired(getPropertyFields)).Methods(http.MethodGet)
api.BaseRoutes.PropertyValues.Handle("", api.APISessionRequired(getPropertyValues)).Methods(http.MethodGet)
if api.srv.Config().FeatureFlags.IntegratedBoards {
if api.srv.Config().FeatureFlags.IntegratedBoards || api.srv.Config().FeatureFlags.ClassificationMarkings {
api.BaseRoutes.PropertyFields.Handle("", api.APISessionRequired(createPropertyField)).Methods(http.MethodPost)
api.BaseRoutes.PropertyField.Handle("", api.APISessionRequired(patchPropertyField)).Methods(http.MethodPatch)
api.BaseRoutes.PropertyField.Handle("", api.APISessionRequired(deletePropertyField)).Methods(http.MethodDelete)
+36
View File
@@ -15,6 +15,42 @@ import (
"github.com/mattermost/mattermost/server/public/model"
)
func TestPropertyRoutesWithClassificationMarkingsFlag(t *testing.T) {
mainHelper.Parallel(t)
// Routes should be available when ClassificationMarkings=true even with IntegratedBoards=false
th := SetupConfig(t, func(cfg *model.Config) {
cfg.FeatureFlags.IntegratedBoards = false
cfg.FeatureFlags.ClassificationMarkings = true
}).InitBasic(t)
group, err := th.App.RegisterPropertyGroup(th.Context, &model.PropertyGroup{
Name: "classification_test",
Version: model.PropertyGroupVersionV2,
})
require.Nil(t, err)
require.NotNil(t, group)
t.Run("create field should succeed with ClassificationMarkings flag", func(t *testing.T) {
field := &model.PropertyField{
Name: model.NewId(),
Type: model.PropertyFieldTypeText,
TargetType: "system",
}
createdField, resp, err := th.SystemAdminClient.CreatePropertyField(context.Background(), group.Name, "post", field)
require.NoError(t, err)
CheckCreatedStatus(t, resp)
require.NotEmpty(t, createdField.ID)
})
t.Run("get fields should succeed with ClassificationMarkings flag", func(t *testing.T) {
_, resp, err := th.SystemAdminClient.GetPropertyFields(context.Background(), group.Name, "post", model.PropertyFieldSearch{TargetType: "system"})
require.NoError(t, err)
CheckOKStatus(t, resp)
})
}
func TestCreatePropertyField(t *testing.T) {
mainHelper.Parallel(t)
th := SetupConfig(t, func(cfg *model.Config) {
+5
View File
@@ -89,6 +89,9 @@ type FeatureFlags struct {
// Enable auto-translation feature for messages in channels
AutoTranslation bool
// Enable classification markings for banners at the system and channel level
ClassificationMarkings bool
// Enable burn-on-read messages that automatically delete after viewing
BurnOnRead bool
@@ -145,6 +148,8 @@ func (f *FeatureFlags) SetDefaults() {
f.AutoTranslation = true
f.ClassificationMarkings = false
f.BurnOnRead = true
// FEATURE_FLAG_REMOVAL: EnableAIPluginBridge - Remove this default when MVP is to be released
+18
View File
@@ -9,6 +9,24 @@ import (
"github.com/stretchr/testify/require"
)
func TestFeatureFlagsSetDefaults(t *testing.T) {
f := &FeatureFlags{}
f.SetDefaults()
t.Run("ClassificationMarkings should default to false", func(t *testing.T) {
require.False(t, f.ClassificationMarkings)
})
t.Run("ClassificationMarkings should serialize correctly", func(t *testing.T) {
m := f.ToMap()
require.Equal(t, "false", m["ClassificationMarkings"])
f.ClassificationMarkings = true
m = f.ToMap()
require.Equal(t, "true", m["ClassificationMarkings"])
})
}
func TestFeatureFlagsToMap(t *testing.T) {
for name, tc := range map[string]struct {
Flags FeatureFlags