Skip to content

fix(web): show the server Owner's role as "owner" instead of "admin" - #1549

Merged
Quick104 merged 2 commits into
mainfrom
t3code/apply-issue-feedback-adjustments
Sep 27, 2026
Merged

Quick104 merged 2 commits into
mainfrom
t3code/apply-issue-feedback-adjustments

Conversation

@Quick104

@Quick104 Quick104 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #1382
Related issue: N/A
Validation tasks: none

This follows up on review feedback on #1382. The admin Users pages showed the server Owner's role as "admin" with a separate "Owner" badge next to it. The account detail page showed "admin" in its Role row, and the disabled Role select in the edit forms showed "Admin". An admin looking at the Owner's account saw two roles that seemed to conflict, and the edit form said nothing about ownership. This change labels the Owner's role "owner" everywhere the web admin UI displays a role.

Approach

A new accountRoleLabel helper in web/src/lib/accountOwner.ts returns "owner" for the Owner account and the stored role for every other account. The Users table and its Role sort, the dashboard Users widget, the detail page header, and the Account panel all use this helper, which replaces the separate "Owner" badge. For the Owner, both edit forms add an "Owner" option to the Role select and show it as selected. That select was already disabled for the Owner, so the added option only changes what it displays.

This is a display-only change. The API still reports the Owner as role: "admin" with is_owner: true, and permission checks still read those fields. Badge styling still keys off role, so the Owner's badge keeps the admin style.

Validation

  • Web unit tests: updated the AdminUsers and AdminUserDetail owner cases to expect "owner" and no "admin" label for the Owner row and detail page.
  • Ran the AdminUsers and AdminUserDetail Vitest suites (70 tests pass), the web typecheck, and Prettier and ESLint on the changed files.
  • No validation case checks how the role is displayed.

Risks

None identified. The change is limited to the web admin UI. No API, jellycompat, or native client changes.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Claude Code (Claude Agent SDK)
  • Tool(s): Claude Code
  • Model(s): claude-opus-5-5
  • Involvement: AI-assisted
  • Adversarial review: n/a

Note

Show server owner role as "owner" instead of "admin" in web admin UI

Adds an accountRoleLabel helper in accountOwner.ts that returns "owner" for accounts with is_owner set, and uses it across the admin UI.

  • The users table, dashboard Users widget, and user detail view now show one "owner" badge instead of an "admin" badge plus a separate "Owner" badge (AdminUsers.tsx, UsersWidget.tsx, AdminUserDetail.tsx)
  • Role sorting in the users table now compares display labels, so owners sort under "owner" rather than "admin"
  • Role selectors show a disabled "Owner" option when editing an owner account; creation and non-owner editing keep the existing User and Admin options
  • Behavioral Change: sortAdminUsers sorts by display label; owner rows and detail views no longer render "admin" text, as asserted in the updated tests

Macroscope summarized 71fb945.

- Add accountRoleLabel so the Owner is labeled "owner" everywhere a role is shown
- Replace the separate Owner badge with the role badge on the users list and detail header
- Show "owner" in the Account panel and the disabled role selects of both edit forms
@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 491b5969-7492-4177-8e88-37cbf73132d7

📥 Commits

Reviewing files that changed from the base of the PR and between 39a5547 and 71fb945.

📒 Files selected for processing (6)
  • web/src/components/admin/dashboard/widgets/UsersWidget.tsx
  • web/src/lib/accountOwner.ts
  • web/src/pages/AdminUserDetail.test.tsx
  • web/src/pages/AdminUserDetail.tsx
  • web/src/pages/AdminUsers.test.tsx
  • web/src/pages/AdminUsers.tsx

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-27T04:07:03.376406Z 44d20f5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 44d20f5bdc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +50 to +52
/** The role shown for an account: the Owner is labeled "owner" rather than "admin". */
export function accountRoleLabel(account: AdminUser): string {
return account.is_owner ? "owner" : account.role;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Apply the owner label to the dashboard widget

When the owner is among the eight accounts shown on the admin dashboard, UsersWidget still checks u.role === "admin" and renders an admin badge (web/src/components/admin/dashboard/widgets/UsersWidget.tsx:89-92). This leaves a prominent admin UI displaying the conflicting role that this helper is intended to replace; use accountRoleLabel there as well.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 71fb945: UsersWidget now uses accountRoleLabel, so the dashboard shows the Owner as "owner".

Comment on lines +433 to +434
<Badge variant={u.role === "admin" ? "default" : "secondary"}>
{accountRoleLabel(u)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Sort roles by the displayed owner label

When an administrator sorts the Role column, this cell now displays owner, but sortAdminUsers still compares the stored a.role/b.role, where the owner remains admin. With an owner and one or more ordinary admins, the owner is therefore interleaved with admins by username instead of being ordered by the visible admin, owner, and user values, despite the column reporting an ascending or descending sort.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 71fb945: the Role sort now compares accountRoleLabel, so the order matches the labels shown.

@macroscopeapp

macroscopeapp Bot commented Sep 27, 2026

Copy link
Copy Markdown

Minor re-check: the Owner now appears as “owner” instead of “admin” plus a separate Owner badge in the validated Users/detail flows. The role API, group restrictions, and impersonation authorization are unchanged; re-check #1197 C1/C2 and #1200 C1/C2 after merge.

Suggested fix: replace Validation tasks: none with Validation tasks: changes #1197 C1, C2; changes #1200 C1, C2.

Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.

Posted via Macroscope — v1 validation impact

@Quick104

Copy link
Copy Markdown
Contributor Author

Keeping Validation tasks: none. #1197 C1/C2 cover creating accounts, groups and invites and checking group policy, and #1200 C1/C2 cover starting and ending impersonation. None of these cases checks how the role is labeled, and this PR changes only that label. The API role, group rules and impersonation checks are unchanged.

@Quick104
Quick104 merged commit b859460 into main Sep 27, 2026
14 checks passed
@Quick104
Quick104 deleted the t3code/apply-issue-feedback-adjustments branch September 27, 2026 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a server Owner role that alone can change admin roles

1 participant