Skip to main content

tungsten-impersonate

"Log in as" plugin for Tungsten, the admin panel for FastAPI. An admin logs in as any user to see exactly what they see. Made for support, and safe by default.

What you get

  • A Log in as button on your users list and user pages, and a Log in as a user picker.
  • An orange bar on every page while you are someone else, with Back to my account and the minutes left.
  • Time limit: you go back to your own account after 60 minutes.
  • Impersonation log: who logged in as whom, when, why, for how long, from which IP and browser.
  • Safety rules: only allowed admins; never as yourself, a super admin, an inactive user or a user with more access than you; no "log in as" from inside another account.
  • Links with other plugins when installed: HR employees with a login, help desk ticket customers, and three security audit checks.

Install

pip install tungsten-impersonate
from tungsten_impersonate import ImpersonatePlugin

panel.plugin(ImpersonatePlugin())
panel.create_tables(engine)   # creates the impersonation log table

With roles, give the Log in as other users permission only to your support admins. Without roles every panel user may use it.

Options

ImpersonatePlugin(
    can_impersonate=None,       # fn(user, ctx) -> bool
    can_be_impersonated=None,   # fn(user, target, ctx) -> bool
    no_more_access=True,        # never become a user with permissions you don't have
    max_minutes=60,             # 0: no limit
    require_reason=False,       # ask "Why?" first
    redirect_to=None,           # page to open as the user
    users=True, link_plugins=True, banner=True, log_resource=True,
    on_start=None, on_end=None,
)

The buttons on your users list and other plugins' screens use panel.record_action() from the tungsten-admin release after 0.1.7. On 0.1.7 add plugin.action() to your users table yourself; the log screen's picker works everywhere.

Docs: https://tungsten.prisminfoways.com/docs/impersonate

Try it

pip install -e . -e plugins/impersonate uvicorn
uvicorn plugins.impersonate.example:app --reload     # from the repo root

Sign in as admin@example.com / password, open Users and press Log in as on a row.

Tests

pip install -e ".[dev]" -e plugins/impersonate -e plugins/hr -e plugins/tickets -e plugins/security-audit
pytest plugins/impersonate/tests

Metadata

Release files for tungsten-impersonate 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tungsten-impersonate 0.1.1
File Size Uploaded Provenance Actions
tungsten_impersonate-0.1.1.tar.gz 18.4 kB Without provenance Details for tungsten_impersonate-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tungsten-impersonate 0.1.1
File Interpreter ABI Platform Actions
tungsten_impersonate-0.1.1-py3-none-any.whl Python 3 none any Details for tungsten_impersonate-0.1.1-py3-none-any.whl

Total release size: 33.8 kB

Release files / tungsten_impersonate-0.1.1.tar.gz

Download URL tungsten_impersonate-0.1.1.tar.gz
Size 18.4 kB
Tags Source
SHA-256 checksum
How to use checksums
501a39be03dbd64da3d1d7a15d45a4fd05bdd8936359d2698f51274dc348cb13
BLAKE2b-256 checksum
How to use checksums
eb40ecc42efd97755262ee9b6a77eae694be8baa006887c33a894c09482bce9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.17

Release files / tungsten_impersonate-0.1.1-py3-none-any.whl

Download URL tungsten_impersonate-0.1.1-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46b2ef295e264b2c62c59580c0b3746edf42a6a040fa830ea143dbcb17065c12
BLAKE2b-256 checksum
How to use checksums
de6fedc2960714af3afc0ac9febf0da88bf56defe55bf24965557a9fe89f8b99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.17

Security for tungsten-impersonate 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page