[PR #8044] [CLOSED] feat(admin): allow dynamic allowImpersonatingAdmins config #15953

Closed
opened 2026-04-13 10:19:19 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8044
Author: @jslno
Created: 2/18/2026
Status: ❌ Closed

Base: canary ← Head: 02-18-2026/allow-impersonating-admins


📝 Commits (2)

  • b6cbdac feat(admin): allow dynamic allowImpersonatingAdmins config
  • ab660d4 chore: update docu

📊 Changes

4 files changed (+206 additions, -6 deletions)

View changed files

📝 docs/content/docs/plugins/admin.mdx (+10 -0)
📝 packages/better-auth/src/plugins/admin/admin.test.ts (+181 -0)
📝 packages/better-auth/src/plugins/admin/routes.ts (+9 -5)
📝 packages/better-auth/src/plugins/admin/types.ts (+6 -1)

📄 Description

Summary by cubic

Adds per-request control for admin impersonation by allowing admin.allowImpersonatingAdmins to be a function. This lets apps decide at runtime if an admin can impersonate another admin.

  • New Features
    • allowImpersonatingAdmins now accepts a boolean or (ctx) => boolean | Promise.
    • Impersonation route evaluates the function to allow/deny admin-to-admin impersonation.
    • Docs updated with a usage example.
    • Tests cover: allow when true, deny when false, deny when function returns false, and blocking users listed in adminUserIds.

Written for commit ab660d4200. Summary will update on new commits.


🔄 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/8044 **Author:** [@jslno](https://github.com/jslno) **Created:** 2/18/2026 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `02-18-2026/allow-impersonating-admins` --- ### 📝 Commits (2) - [`b6cbdac`](https://github.com/better-auth/better-auth/commit/b6cbdacabd4288ad69003e738f1d28fceef94b39) feat(admin): allow dynamic `allowImpersonatingAdmins` config - [`ab660d4`](https://github.com/better-auth/better-auth/commit/ab660d4200627b1fa92300fd57b448826bc4170e) chore: update docu ### 📊 Changes **4 files changed** (+206 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/admin.mdx` (+10 -0) 📝 `packages/better-auth/src/plugins/admin/admin.test.ts` (+181 -0) 📝 `packages/better-auth/src/plugins/admin/routes.ts` (+9 -5) 📝 `packages/better-auth/src/plugins/admin/types.ts` (+6 -1) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Adds per-request control for admin impersonation by allowing admin.allowImpersonatingAdmins to be a function. This lets apps decide at runtime if an admin can impersonate another admin. - **New Features** - allowImpersonatingAdmins now accepts a boolean or (ctx) => boolean | Promise<boolean>. - Impersonation route evaluates the function to allow/deny admin-to-admin impersonation. - Docs updated with a usage example. - Tests cover: allow when true, deny when false, deny when function returns false, and blocking users listed in adminUserIds. <sup>Written for commit ab660d4200627b1fa92300fd57b448826bc4170e. Summary will update on new commits.</sup> <!-- 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-04-13 10:19:19 -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#15953