Repository navigation
Fixes 37701: Reserve the Admin role name and label the admin flag apart from roles - #37702
Conversation
|
Local Java test run: PASSED — details
Tests run locally
Per-class counts come from the test reports, which can credit a test to the wrong class when classes run concurrently, and keep only the last run of a nested class that several test classes inherit. The summary's step totals are Maven's own counts. Broader coverage not executed by this focused run
Impacted, not run locally (6)
Commandsmvn -B package -pl openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=CatalogExceptionMessageTest -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel -Dit.test=RoleResourceIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false |
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
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 |
Code Review ✅ Approved 🟡 Medium riskRejecting new Admin-named roles and distinguishing the superuser flag in the UI could disrupt workflows that rely on creating that previously accepted role. Reserves the 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 |
Describe your changes:
Fixes #37701
Admin access is the
isAdminflag on a user or bot, not a role. The role editors list that flag as an option called "Admin" next to the real roles. Nothing stopped anyone from also creating a role namedAdmin, so the editor could show two identical "Admin" options: one makes the user a superuser, the other grants only its policies. It was easy to pick the wrong one.This PR:
Admin(any case) with a 400. The check sits inRoleRepository.createNewEntity, which both POST and PUT-create go through. Roles cannot be renamed, so that is the only way in. Roles that already have the name keep working and stay editable.label.admin-superuser, translated in every locale). That covers the bot and user role editors (classic and AI mode), the read-only roles views, the user popover, the profile menu and the AI user menu.admin, and the classic editors labelled any held role missing from the loaded page of roles as the admin flag. Both now show the right name.ADR:2026-11-12-admin-is-a-reserved-role-name.Type of change:
High-level design:
Adminmay be referenced by name in policy conditions and integrations, so this PR does not rename them. The new label already tells them apart in the UI. Such a role still cannot be assigned through SSO role mapping (anAdminclaim means the flag); renaming it is left to the admin.createNewEntity: POST runsprepare(role, false), but PUT-create runsprepare(role, true), sopreparecannot tell a new role from an update.createNewEntityis the one method every create path shares.RoleResourcehas no bulk or CSV endpoint.adminwould look the same in the editors.Tests:
Use cases covered
Adminoradminthrough POST or PUT returns 400 with a "reserved" message.Adminsees "Admin" and "Admin (superuser)" as two different options, and saving sends the role as a role and the flag asisAdmin.admin.Unit tests
RolesCard.test.tsx(3 cases; the label cases fail without the fix), a new case inBotDetailPanel.test.tsx.UserRoles.test.tsx,PopoverContent.test.tsx,MembershipSection.test.tsx,PermissionsTab.test.tsx.src/components/common,Settings/Users,Settings/Botanddiscovery/personal-space: 477 suites, 5,006 tests, all passed. ESLint and Prettier clean on changed files.yarn tsc:checkshows no errors in changed files.Backend integration tests
RoleResourceIT#test_roleNamedAdminIsRejected(POST and PUT, two spellings).The run below is at
1e789f0172b1. The later commits change only UI files.Local Java test run: PASSED
1e789f0172b1(baseorigin/main)--scope full).Ingestion integration tests
Playwright (UI) tests
make playwright_affectedselects about 50 specs, most because its map has no entry forRoleRepositoryor the role components. The relevant ones (Roles,BotsProfile,Users,AIProfile/ProfileDetails) usetoContainText('Admin'), which the new label still satisfies. They are pending for the merge queue.Manual testing performed
None on a running stack. The behaviour is covered by the IT and Jest cases above.
UI screen recording:
Not applicable: a bug fix that changes a label, not a UI feature.
Checklist:
I have read the CONTRIBUTING document.
My PR title is
Fixes <issue-number>: <short explanation>My PR is linked to a GitHub issue via
Fixes #<issue-number>above.I have commented on my code, particularly in hard-to-understand areas.
For JSON Schema changes: not applicable, no schema change.
For a UI feature or feature task: not applicable, bug fix.
I have added tests (unit / integration / Playwright as applicable) and listed them above.
Self-review: I reviewed the final diff against
REVIEW.md(thepr-checklistskill runs it) and fixed every 🔴 finding, or answered it on the line below.2702ba80da71(three passes; every 🔴 fixed). 🟡 left open, all non-blocking: the AI-mode bot editor still shows a held role missing from the loaded list by its id (pre-existing);UserProfileRoles,UserProfileIcon,RolesElementandAIUserMenuhave no Jest case for the new label;UserProfileRoles' admin chip shares the React keyAdminwith a legacy role namedAdmin, becauseChipkeys by name (pre-existing).Decision check: adds
docs/decisions/2026-11-12-admin-is-a-reserved-role-name.md.I have added a test that covers the exact scenario we are fixing.


Confidence Score: 5/5
This PR appears safe to merge; no actionable issues were found.Summary
Reserves
Admin, ignoring case, for new roles and labels theisAdminflag as “Admin (superuser)” across the changed user and bot views.Reviews (1) · Last reviewed commit: "Merge branch 'main' into fix/admin-role-..." · Reviewed by Greptile