Skip to content

feat(user): implement users manager#289

Merged
l1ttps merged 29 commits intomainfrom
feat/user-management
Mar 16, 2026
Merged

feat(user): implement users manager#289
l1ttps merged 29 commits intomainfrom
feat/user-management

Conversation

@mizhm
Copy link
Copy Markdown
Contributor

@mizhm mizhm commented Mar 2, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 2, 2026 01:40
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces robust user management capabilities to the console application, empowering administrators with a dedicated interface to oversee and control user accounts. It includes a new navigation entry, a dynamic user listing page, and a detailed user profile view that facilitates administrative actions like banning and role assignment. The changes also include an improvement to the underlying data table hook for more efficient parameter handling.

Highlights

  • User Management Interface: A new 'Admin' section has been added to the console's sidebar navigation, featuring a 'Users' submenu item. This provides a dedicated entry point for administrative user management.
  • User Listing and Details: New pages and components have been introduced to display a comprehensive list of users in a data table, complete with filtering, sorting, and pagination. Clicking on a user opens a detail sheet where administrators can view user information and perform actions.
  • Administrative Actions: The user detail sheet enables administrators to ban or unban users and change their roles (e.g., to 'admin' or 'user'), with immediate feedback via toast notifications.
  • Enhanced Data Table Hook: The useServerDataTable hook has been refactored to allow setting multiple table parameters (like page, pageSize, sortBy, sortOrder, and filter) simultaneously using a single setParams function, improving flexibility and reducing boilerplate.
  • Auth Client Integration: The better-auth/client/plugins admin client has been integrated into the authClient, and the User type has been extended to include administrative fields such as role, banned, banReason, and banExpires.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • console/src/components/common/layout/menu-bar.tsx
    • Added a new 'Admin' menu item with a 'Users' submenu to the sidebar.
  • console/src/hooks/useServerDataTable.ts
    • Refactored the setParam function to setParams to allow updating multiple data table parameters simultaneously.
    • Updated all table handlers to use the new setParams function for consistency.
  • console/src/pages/admin/list-users.tsx
    • Added a new page component to display a paginated, sortable, and filterable list of users using useServerDataTable.
    • Implemented user data fetching and display, including user status (banned/active) and role badges.
  • console/src/pages/admin/user-detail-sheet.tsx
    • Added a new sheet component to display detailed user information.
    • Implemented functionality to ban/unban users and change user roles via mutations.
    • Displayed user status, role, ban reason, and ban expiration date.
  • console/src/pages/admin/users.tsx
    • Added a new wrapper page component for the user listing.
  • console/src/routers/index.tsx
    • Configured new routes for the /admin/users page.
  • console/src/utils/authClient.ts
    • Integrated the adminClient plugin from better-auth/client/plugins.
    • Extended the User type to include role, banned, banReason, and banExpires properties for administrative purposes.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an Admin “Users” management surface to the console using better-auth’s admin client plugin, including routing, navigation, and new pages for listing users and viewing/updating user status.

Changes:

  • Enable better-auth admin plugin in the console auth client and introduce a local User type.
  • Add /admin/users route + sidebar navigation entry, and implement Users page, list view, and detail/action sheet.
  • Refactor useServerDataTable to support setting multiple params at once via setParams.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
console/src/utils/authClient.ts Enables adminClient() plugin and defines an extended User type used by the admin UI.
console/src/routers/index.tsx Registers the new /admin/users route under the authenticated area.
console/src/pages/admin/users.tsx Adds the top-level Admin Users page wrapper.
console/src/pages/admin/list-users.tsx Implements server-driven user listing table and selection to open a detail sheet.
console/src/pages/admin/user-detail-sheet.tsx Implements user detail display and admin actions (ban/unban, role change).
console/src/hooks/useServerDataTable.ts Refactors param updates to a multi-field setParams helper.
console/src/components/common/layout/menu-bar.tsx Adds “Admin → Users” entry to the sidebar navigation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a user management feature, including a user list page and a user detail view with admin actions, along with new routes and components. A critical security vulnerability has been identified: the new 'Admin' menu section and the /admin/users route lack proper role-based access control (RBAC) on the frontend, making them accessible to any authenticated user and exposing sensitive data. Additionally, the review highlighted areas for improvement in the new components, including suboptimal initial loading state handling in list-users.tsx, incomplete query invalidation in user-detail-sheet.tsx which could lead to stale data, and a minor issue with accessing a user's name for the avatar fallback.

},
onSuccess: () => {
toast.success(`User has been ${aUser?.banned ? 'unbanned' : 'banned'}.`);
return queryClient.invalidateQueries({ queryKey: ['user', aUser?.id] });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

After successfully updating a user's status (ban/unban), the list of users on the main page should be updated to reflect this change. Currently, only the specific user query (['user', aUser?.id]) is invalidated. You should also invalidate the users list query to ensure the UI is consistent.

      queryClient.invalidateQueries({ queryKey: ['users'] });
      return queryClient.invalidateQueries({ queryKey: ['user', aUser?.id] });

},
onSuccess: () => {
toast.success('User role updated.');
return queryClient.invalidateQueries({ queryKey: ['user', aUser?.id] });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

After successfully updating a user's role, the list of users on the main page should be updated to reflect this change. Currently, only the specific user query (['user', aUser?.id]) is invalidated. You should also invalidate the users list query to ensure the UI is consistent.

      queryClient.invalidateQueries({ queryKey: ['users'] });
      return queryClient.invalidateQueries({ queryKey: ['user', aUser?.id] });

@l1ttps l1ttps changed the title Feat/user management feat(user): implement users manager Mar 7, 2026
mizhm and others added 9 commits March 7, 2026 16:12
* feat(asset): add tls filter for asset

* fix(core): fix asset test

* fix(asset): fix based on bot reviews

* fix(console): fix small typo in tls tab

* fix(console): add missing tls for queryParams in asset context

* fix(console): fix tls query hook in dashboard

---------

Co-authored-by: Quang Vinh <32523515+l1ttps@users.noreply.github.com>
Bumps [multer](https://github.com/expressjs/multer) from 2.0.2 to 2.1.0.
- [Release notes](https://github.com/expressjs/multer/releases)
- [Changelog](https://github.com/expressjs/multer/blob/main/CHANGELOG.md)
- [Commits](expressjs/multer@v2.0.2...v2.1.0)

---
updated-dependencies:
- dependency-name: multer
  dependency-version: 2.1.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* refactor(targets): combine logic create target in transaction

* feat(targets): add bulk target creation endpoint

* feat(targets): add bulk creation support
Co-authored-by: Quang Vinh <32523515+l1ttps@users.noreply.github.com>
…nd re-design settings ui (#299)

* feat(console): add all workspaces navigation and improve 404 page UI

* refactor(layout): extract header into dedicated HeaderBar component

* refactor(console): add workspace-aware header layout

* refactor(console): convert workspace creation to page and add route protection

* refactor(console): update workspaces UI from table to card layout

* feat(workspaces): add member and target counts to workspace list

* refactor(settings): reorganize settings page with sidebar layout

* feat(settings): add API keys management

* refactor(settings): improve API key display layout

* fix(screenshot-cell): add type assertion for screenshotPath

* refactor(workspaces): use workspace selector hook
[setParams],
),
setFilter: useCallback(
(v: string) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: setFilter should implement debouncing

For search/filter functionality, consider adding debounce to prevent excessive API calls while user is typing.

setParam('filter', v);
}
if (filter === v) return;
setParams({
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: Consider resetting page on filter change

When filter changes, it's common practice to reset to page 1 since the filtered results may have different pagination. This is already implemented, which is good.

const formSchema = z.object({
name: z.string().min(1, 'Name is required'),
email: z.string().min(1, 'Email is required').email('Invalid email address'),
password: z.string().min(8, 'Password must be at least 8 characters'),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: Add password confirmation field for better UX and security

The password field lacks a confirmation field which is standard practice for user creation to prevent typos. Consider adding a 'confirmPassword' field with validation that it matches the password field.

<FormItem>
<FormLabel>Password</FormLabel>
<FormControl>
<Input
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: Consider showing password strength indicator

For better user experience, consider adding a password strength indicator to help users create stronger passwords.

<FormControl>
<Input
type="password"
placeholder="Min. 8 characters"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: Add 'show password' toggle for accessibility

Consider adding a toggle to show/hide the password field content for better accessibility and user experience.

@kilo-code-bot
Copy link
Copy Markdown

kilo-code-bot bot commented Mar 14, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

@l1ttps l1ttps merged commit 01dd1cb into main Mar 16, 2026
15 checks passed
@l1ttps l1ttps deleted the feat/user-management branch March 22, 2026 03:23
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.

3 participants