Skip to content

feature: add support for viewing, adding and removing system admins#1062

Merged
evanrbowers merged 3 commits intomainfrom
system-admin
Mar 31, 2026
Merged

feature: add support for viewing, adding and removing system admins#1062
evanrbowers merged 3 commits intomainfrom
system-admin

Conversation

@evanrbowers
Copy link
Copy Markdown
Contributor

Changes

@aws-amplify-us-west-1
Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-1062.d20k671nqqv4kl.amplifyapp.com

@JamieRuderman
Copy link
Copy Markdown
Member

@codex review

Copy link
Copy Markdown

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

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: 52b26d45cb

ℹ️ 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".

break
}
}
const result = await graphQLAdminUsers({ from: 0, size: 100 }, filters, 'email')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Paginate admin queries instead of limiting to first 100

The admins list always calls graphQLAdminUsers({ from: 0, size: 100 }, ...) and never follows hasMore/total, so tenants with more than 100 admins will silently lose visibility of everyone past the first page. In that scenario admins beyond index 100 cannot be discovered from the list UI (and therefore are effectively unmanaged unless the operator already knows exact identifiers to search).

Useful? React with 👍 / 👎.

Comment on lines +42 to +43
if (result !== 'ERROR' && result?.data?.data?.admin?.users?.items?.[0]) {
setAdmin(result.data.data.admin.users.items[0])
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 Treat non-admin accounts as not found in admin detail panel

fetchAdmin accepts any user returned for adminId and stores it without checking user.admin, but this page always renders “System Admin” and admin-only actions. If someone navigates directly to /admin/admins/<non-admin-id>, the UI misclassifies that account as an admin and offers incorrect actions, so the detail view should reject non-admin records before rendering.

Useful? React with 👍 / 👎.

Comment on lines +62 to +64
history.push('/admin/admins')
onAdminRemoved?.()
window.dispatchEvent(new Event('refreshAdminData'))
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 Invalidate adminUsers cache after demoting an admin

After successful demotion this flow only redirects and emits refreshAdminData, but it never invalidates/refetches adminUsers state. Because adminUsers.fetchUserDetail returns cached entries first and the users page only fetches when empty, previously cached data can continue to show the demoted account as admin until a manual refresh, creating inconsistent admin status across pages.

Useful? React with 👍 / 👎.

@evanrbowers evanrbowers merged commit 704ff5b into main Mar 31, 2026
7 of 8 checks passed
@evanrbowers evanrbowers deleted the system-admin branch March 31, 2026 18: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.

2 participants