Skip to content

[2.0] Fixes #31770: restrict direct users to Group teams - #32372

Merged
yan-3005 merged 13 commits into
2.0from
backport-31770-2.0
Sep 7, 2026
Merged

yan-3005 merged 13 commits into
2.0from
backport-31770-2.0

Conversation

@yan-3005

@yan-3005 yan-3005 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #31770

Backports the non-Group team user-membership validation to 2.0. Direct user memberships are now rejected for Department, Division, and BusinessUnit teams across team and user write paths. Existing invalid data requires the agreed DB cleanup; this PR intentionally adds no migration or API bypass.

Type of change:

  • Bug fix

High-level design:

Validation is at the relationship write boundaries. The shared test bootstrap assigns its users to existing child Group teams, so it remains valid without changing downstream test semantics.

Tests:

  • Updated TeamResourceIT and UserResourceIT for the affected API paths.
  • mvn spotless:apply passed.
  • CI will run the integration suite.

UI screen recording / screenshots:

Not applicable.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR is linked to a GitHub issue via Fixes #31770 above.
  • I have added tests covering the changed behavior.

@yan-3005
yan-3005 requested a review from a team as a code owner September 1, 2026 13:44
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 08a8befd60718a074e4b88d7c02b096c2f047195 in Playwright run 34093676110, attempt 1.

✅ 784 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 49m 33s

⏱️ Max setup 3m 0s · max shard execution 17m 45s · max shard-job elapsed before upload 21m 8s · reporting 6s

🌐 201.86 requests/attempt · 2.54 app boots/UI scenario · 36.15% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 36.15% (convergence target: at most 15%).
  • Browser traffic was 201.86 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.54 per UI scenario (2049 boots / 807 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 118 0 0 0 0 0
✅ Shard chromium-02 120 0 0 0 0 0
✅ Shard chromium-03 136 0 0 0 0 0
✅ Shard chromium-04 135 0 0 0 0 0
✅ Shard chromium-05 119 0 0 0 0 0
✅ Shard data-asset-rules-01 63 0 0 0 0 0
✅ Shard domain-isolation-01 16 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard ingestion-01 1 0 0 0 0 0
✅ Shard reindex-01 2 0 0 0 0 0
✅ Shard search-01 11 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@yan-3005 yan-3005 changed the title Fixes #31770: restrict direct users to Group teams [2.0] Fixes #31770: restrict direct users to Group teams Sep 3, 2026
@yan-3005 yan-3005 mentioned this pull request Sep 3, 2026
9 tasks done
@gitar-bot

gitar-bot Bot commented Sep 7, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 resolved / 1 findings

Backports non-Group team user-membership validation to 2.0, restricting direct user assignments to Department, Division, and BusinessUnit teams across team and user write paths. The validateGroupTeams(origTeams) check that was blocking API cleanup of invalid data has been resolved.

✅ 1 resolved
✅ Bug: validateGroupTeams(origTeams) blocks API cleanup of invalid data

📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/UserRepository.java:1638-1642
In UserRepository.updateTeams, both origTeams and updatedTeams are validated. For a legacy user who already belongs to a Department/Division/BusinessUnit team (the exact invalid data this PR expects to exist and be cleaned up), validateGroupTeams(origTeams) throws IllegalArgumentException whenever the teams field is updated — including an update whose sole purpose is to remove that invalid membership. This makes it impossible to remediate the bad data via the API and forces manual DB surgery. Validate only updatedTeams (the desired new state); the original state should not be re-validated on write.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonarqubecloud

sonarqubecloud Bot commented Sep 7, 2026

Copy link
Copy Markdown

@yan-3005
yan-3005 merged commit 3e4f603 into 2.0 Sep 7, 2026
124 of 126 checks passed
@yan-3005
yan-3005 deleted the backport-31770-2.0 branch September 7, 2026 08:58
@yan-3005 yan-3005 self-assigned this Nov 19, 2026

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants