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.0a3.tar.gz (12.8 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.0a3-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for datasette_debug_gotham-0.1.0a3.tar.gz
Algorithm Hash digest
SHA256 db3e4ed3d526bc16db3cbae398a9a10ab2523e7790dc2614ddce1ef476b54a10
MD5 9982ff96e13921f886336109dd913afe
BLAKE2b-256 29b61876d995bb9e17bcf3e52fff038c8bef3832da42710d975521c5c23d7a1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for datasette_debug_gotham-0.1.0a3.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.0a3-py3-none-any.whl.

File metadata

File hashes

Hashes for datasette_debug_gotham-0.1.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 420edd559af96c6b301e704a1fe7c23dc9f16a38f66105f6702bb908f3e36fbf
MD5 add36dcdd5d67f963bcbeb5f6e047d93
BLAKE2b-256 5618f22428bd300191f400744d278e041bb8abb478c67df6f09b072572ba249f

See more details on using hashes here.

Provenance

The following attestation bundles were made for datasette_debug_gotham-0.1.0a3-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