Admin Plugin, Should an admin user be able to remove themselves? #1709

Closed
opened 2026-03-13 08:57:52 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @yakupensarsayin on GitHub (Aug 14, 2025).

Is this suited for github?

  • Yes, this is suited for github

As an admin user, you can remove yourself even though you cannot ban yourself. Did something slip through the cracks here, or was this done intentionally?

This is what I'm talking about:

const { data, error } = await authClient.admin.removeUser({
  userId: user.id, // This could be the user's own ID.
});

Describe the solution you'd like

If this was not done intentionally, the removeUser function in the admin plugin should compare the user.id received from the request with the userId to be removed.

Describe alternatives you've considered

Such a check can be performed on the client and backend sides. However, I found it strange that although there is such a check in banUser, there is no such check in removeUser.

Additional context

No response

Originally created by @yakupensarsayin on GitHub (Aug 14, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. As an admin user, you can remove yourself even though you cannot ban yourself. Did something slip through the cracks here, or was this done intentionally? This is what I'm talking about: ```javascript const { data, error } = await authClient.admin.removeUser({ userId: user.id, // This could be the user's own ID. }); ``` ### Describe the solution you'd like If this was not done intentionally, the removeUser function in the admin plugin should compare the user.id received from the request with the userId to be removed. ### Describe alternatives you've considered Such a check can be performed on the client and backend sides. However, I found it strange that although there is such a check in banUser, there is no such check in removeUser. ### Additional context _No response_
GiteaMirror added the plugin label 2026-03-13 08:57:52 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1709