Skip to main content

A debugging utility for testing actor permissions/actions with DC Superheros (superman, Batman, Daily Planet, etc.)

Project description

datasette-debug-gotham

PyPI Changelog Tests License

A debugging utility for testing actor permissions/actions with DC Superheros (superman, Batman, Daily Planet, etc.)

It can be hard to test or debug Datasette plugins that use the new permissions system. This plugin offers a few builtin actors and a small widget for switching between actors:

Once you select an actor like "Clark Kent" or "Bruce Wayne", the page will refresh and Datasette will recognize the actor in request.actor. You can change actors however you like:

The pre-configured actors have some attributes you can use for debugging or "group permissions":

# https://github.com/datasette/datasette-debug-gotham/blob/main/datasette_debug_gotham/__init__.py#L8-L21
ACTORS = {
    ###### DAILY PLANET ######
    "clark": {
        "id": "clark",
        "name": "Clark Kent",
        "newsroom": "daily-planet",
        "profile_picture_url": pfp("C", bg="blue"),
    },
    "lois": {
        "id": "lois",
        "name": "Lois Lane",
        "newsroom": "daily-planet",
        "profile_picture_url": pfp("L", bg="red"),
    },
    ... # many more
}

Or access the actors with Python:

from dataseette_debug_gotham import ACTORS
print(ACTORS["clark"])

Personally I use this with uv for dynamic permissions testing:

uvx \
  --from 'datasette>=1a' \
  --with datasette-debug-gotham \
  datasette \
    --default-deny \
    -s permissions.view-instance.newsroom daily-planet \
    --memory

Here --default-deny means that by default everyone will see a Forbidden view-instance error when visiting dataset.

But, if you use the debug widget and select clark/lois/jimmy, since they have newsroom: daily-planet in their actor config, they will be able to see the instance!

And if you change to bruce/alfred/selina, who have newsroom: gotham-gazette, they will be blocked!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datasette_debug_gotham-0.1.0a2.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datasette_debug_gotham-0.1.0a2-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file datasette_debug_gotham-0.1.0a2.tar.gz.

File metadata

  • Download URL: datasette_debug_gotham-0.1.0a2.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for datasette_debug_gotham-0.1.0a2.tar.gz
Algorithm Hash digest
SHA256 a2f818ca0656c7f45c48e273d38c0f8955d873e530e19fd78485b41338a10529
MD5 7dde699762ba740fdb13de5ffe0b7862
BLAKE2b-256 f6a2b887a1c9a1ed56c5c1182a63d287b06ec7a2af3e4b8ce1d706a46fdba3ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for datasette_debug_gotham-0.1.0a2.tar.gz:

Publisher: publish.yml on datasette/datasette-debug-gotham

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file datasette_debug_gotham-0.1.0a2-py3-none-any.whl.

File metadata

File hashes

Hashes for datasette_debug_gotham-0.1.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 5c413b1a0c30c060c9d1622d963a8bf0ea30782a32a3feadc9cd685072543018
MD5 e43d6f45a505812ed3e78e2cede80d6a
BLAKE2b-256 bd3d4466beb02efe9d5f8e1df8341ef2c9a2c5e80036b6327369e37090040916

See more details on using hashes here.

Provenance

The following attestation bundles were made for datasette_debug_gotham-0.1.0a2-py3-none-any.whl:

Publisher: publish.yml on datasette/datasette-debug-gotham

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page