[PR #4008] [MERGED] feat(admin): add control to prevent admin users from deleting themselves #5133

Closed
opened 2026-03-13 12:11:46 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4008
Author: @yakupensarsayin
Created: 8/14/2025
Status: Merged
Merged: 8/14/2025
Merged by: @Bekacru

Base: canaryHead: feat/admin


📝 Commits (2)

  • bf572a8 feat(admin): add control to prevent admin users from deleting themselves
  • 839eed6 fix(admin): fix naming inconsistency

📊 Changes

2 files changed (+8 additions, -0 deletions)

View changed files

📝 packages/better-auth/src/plugins/admin/admin.ts (+7 -0)
📝 packages/better-auth/src/plugins/admin/error-codes.ts (+1 -0)

📄 Description

https://github.com/better-auth/better-auth/issues/4006


Summary by cubic

Added a check to prevent admin users from deleting their own accounts, improving account safety.

  • Bug Fixes
  • Returns an error message if an admin tries to remove themselves.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4008 **Author:** [@yakupensarsayin](https://github.com/yakupensarsayin) **Created:** 8/14/2025 **Status:** ✅ Merged **Merged:** 8/14/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `feat/admin` --- ### 📝 Commits (2) - [`bf572a8`](https://github.com/better-auth/better-auth/commit/bf572a891c9b240261f1b1e810ec952ba858154b) feat(admin): add control to prevent admin users from deleting themselves - [`839eed6`](https://github.com/better-auth/better-auth/commit/839eed6c43115f22ad76a0b21ffd50684dcf0ce2) fix(admin): fix naming inconsistency ### 📊 Changes **2 files changed** (+8 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/admin/admin.ts` (+7 -0) 📝 `packages/better-auth/src/plugins/admin/error-codes.ts` (+1 -0) </details> ### 📄 Description https://github.com/better-auth/better-auth/issues/4006 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Added a check to prevent admin users from deleting their own accounts, improving account safety. - **Bug Fixes** - Returns an error message if an admin tries to remove themselves. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:11:46 -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#5133