Files
mattermost/server
Julien TantandClaude Sonnet 5 38b66d2262 [MM-69845] Add Global Attributes access gate to System Console (#37580)
* [MM-69845] Add Global Attributes access gate to System Console

Adds a hidden "Manage Attributes" shell page under the System
Attributes section, gated by a new FeatureFlags.GlobalAttributes
flag, Enterprise license tier, and sysadmin role. Also fixes
admin_sidebar.tsx never threading isCurrentUserSystemAdmin into its
isHidden(...) calls, which would have kept any sysadmin-gated
subsection permanently hidden from the menu regardless of role.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* [MM-69845] Match Manage Attributes gating to the Classification Markings pattern

Ticket was clarified: the sysadmin condition restricts edit access
(isDisabled), not visibility (isHidden) — the page stays reachable to
anyone who can already see the System Attributes section, matching
how Classification Markings gates its own page, rather than the
uniform three-way hide this PR originally built.

This removes the need for the admin_sidebar.tsx/index.ts plumbing fix
from the previous commit: the sidebar only ever evaluates isHidden,
never isDisabled, so no changes to shared sidebar code are needed.
Also adds a one-line placeholder to the shell per reviewer request.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* [MM-69845] Add e2e test for Global Attributes access gate

Covers the two QA-relevant states from the PR: feature flag off hides
the page regardless of license, and flag-on with an Enterprise+
license shows the empty shell with its placeholder text. Modeled on
classification_markings.spec.ts, the closest existing precedent for a
feature-flag + license-tier gated System Console page.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* [MM-69845] Address review feedback on e2e/unit test coverage

- Restore the GlobalAttributes flag to its pre-test value in
  afterAll instead of forcing it to false, so the e2e spec doesn't
  leave a config side effect on environments where it was already on.
- Remove the redundant systemConsolePage.goto() before navigating
  straight to the Manage Attributes path.
- Scope the flag-off absence assertion to the sidebar instead of the
  whole page, so an unrelated "Manage Attributes" string elsewhere
  can't produce a false pass.
- Add an unlicensed-server case to the isHidden predicate matrix.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* [MM-69845] Scope remaining e2e assertions to testid, drop ambiguous .first()

Switch the sidebar locator from a CSS class to getByTestId('admin-sidebar'),
matching the data-testid already on that element. Split the flag-on test's
single .first() assertion into two testid-scoped assertions (sidebar entry,
page heading) instead of relying on DOM-order luck between the two elements
that both render "Manage Attributes".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* [MM-69845] Fix prettier formatting in global_attributes.spec.ts

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* [MM-69845] Skip flag cleanup when env/SplitKey overrides GlobalAttributes

getConfig() returns the effective value, which reflects any env var
or SplitKey override rather than what's actually persisted. Writing
that effective value back in afterAll would silently corrupt the
persisted config on environments where an override is active. Add
isGlobalAttributesFlagOverridden() (checks getEnvironmentConfig() for
an env override and ServiceSettings.SplitKey for live flag sync) and
skip capturing/restoring the flag entirely when either is true.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* [MM-69845] Revert override-detection layer in e2e cleanup

No other spec in this suite checks env/SplitKey overrides before
restoring a feature flag (classification_markings.spec.ts and
global_classification_banner.spec.ts both toggle flags directly with
no such guard). Matching that established convention over the
theoretically-more-correct-but-unprecedented approach; the simple
capture-and-restore is enough.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-22 09:50:44 -07:00
..
2026-06-29 20:33:46 +02:00
2026-07-21 13:10:25 -04:00
2026-04-21 02:33:20 -07:00