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.2

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.2
File Size Uploaded Provenance Actions
tungsten_impersonate-0.1.2.tar.gz 18.5 kB Without provenance Details for tungsten_impersonate-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 33.9 kB

Release files / tungsten_impersonate-0.1.2.tar.gz

Download URL tungsten_impersonate-0.1.2.tar.gz
Size 18.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4be2139f0b41ee29045b91070606e72bf74f3343ec114049013e1d36de524f86
BLAKE2b-256 checksum
How to use checksums
0fe4deba9e8d7dfef7e04770ea0eda862301ebac782a5fbb7c1e5c8b84bcfabc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.18

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

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

Security for tungsten-impersonate 0.1.2

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