Repository navigation
Fixes #35869: Add tests for leaving a non-joinable team - #39677
Conversation
…dmin Leaving a team that is not joinable already needs an admin on user PUT, PATCH and CSV import (UserRepository.changesClosedTeamMembership). Add the missing ITs: swapping a closed team for an open one by PUT and PATCH is refused and keeps the team's default role, leaving an open team still works, and an admin still removes a user from a closed team. Describe the rule on isJoinable and record it in the closed-team decision record.
On a team that is not joinable, members are added or removed by an admin editing the user, or by anyone allowed to edit the team's users editing the team. The description now says so. The decision record's v4 entry only adds the new tests to its Guard list.
Code Review ✅ Approved 🟢 Low riskThe added tests and clarified team-joinability descriptions document existing behavior; no production logic or access rules change. Adds tests and documentation confirming that non-admin users cannot leave a closed team via VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
🤖 Backport to |
|
🤖 Backport to |
|
🤖 Backport to |
|
🤖 Backport to |
Describe your changes:
Fixes #35869
The check itself is already on
main: #36952 made a non-admin's team change count teams the user leaves as well as joins (changesClosedTeamMembership), and #38848 moved it intoUserRepositoryand applied it to user CSV import. This PR adds the tests and the documentation the issue still asks for. No server code changes.UserTeamAssignmentPrivilegeIT):test_selfUpdate_cannotLeaveClosedTeam: a user swapping their closed team for an open one byPUTand byPATCH replace /teamsgets 403, stays in the closed team, is not added to the open one, and keeps the team's default role.test_selfUpdate_canLeaveOpenTeam: leaving an open team still works, byPUTand byPATCH remove.test_adminRemoval_fromClosedTeam_stillWorks: an admin still removes a user from a closed team (PATCH) and moves one between closed teams (PUT).PATCH remove /teams/0) are already covered byUserResourceIT#test_nonAdmin_cannotLeaveClosedTeam.isJoinabledescription (team.json,createTeam.json,teamHierarchy.json,openmetadata.ttl, generated TS): it said only "Can any user join this team during sign up?". It now reads: "Can users join or leave this team on their own? When false, only an admin (by editing the user) or someone allowed to edit the team's users (by editing the team) can add or remove members."ADR:2026-10-30-only-admins-add-roles-or-policies-to-a-team, v4).Type of change:
Checklist:
Fixes <issue-number>: <short explanation>