Skip to main content

entirius-django-access

A Django module for staff access in Entirius, the open-source modular ecommerce platform: roles per module area, an admin API gate, and application tokens. It replaces the per-module API keys with hashed, scoped tokens and records every access change in an audit log.

PyPI Python License: MPL-2.0

What it does

  • Grants staff roles per module area: the built-in Administrator, Manager, Editor and Viewer, plus custom roles.
  • Gates every admin API route by role, with the modes enforce, observe and off (ACCESS_GATE_MODE).
  • Issues hashed application tokens with scopes, channel pinning, expiry and rotation.
  • Imports the modules' legacy API keys as tokens, so existing callers keep working.
  • Writes an audit log of every role, grant and token change.
  • Guards the service's password login against repeated failed attempts.

Token scopes: checkout.storefront, checkout.erase, accounts.erase, contact_forms.submit, contact_forms.booking, returns.api, reviews.moderate, vault.api, agreements.subscribe.

Installation

uv add entirius-django-access
pip install entirius-django-access
INSTALLED_APPS = [
    ...
    "rest_framework",
    "rest_framework_simplejwt",
    "drf_spectacular",
    "django_access",
]

MIDDLEWARE = [
    ...  # SessionMiddleware, AuthenticationMiddleware
    "django_access.middleware.AccessGateMiddleware",  # after authentication
]

SPECTACULAR_SETTINGS = {
    ...
    "POSTPROCESSING_HOOKS": [
        "drf_spectacular.hooks.postprocess_schema_enums",
        "django_access.openapi.add_api_key_security",
    ],
}

# urls.py
urlpatterns = [
    path("", include("django_access.urls")),
]

The Entirius backend service (Volkanos) wires all of this itself when the package is installed.

Settings: ACCESS_GATE_MODE (default enforce) and ACCESS_TOKEN_ROTATION_DAYS, next to the failed-login limits; the reference with defaults, the prerequisites and the deploy order are in https://github.com/entirius/entirius-django-access/blob/develop/docs/install.md.

Quick start

Issue a token for an application; the raw value is printed once:

python manage.py access_token create --application storefront --create-application \
    --scope checkout.storefront --channel <idx>

A module that protects a route with a key checks the request against a scope:

from django_access.services.tokens import verify_api_key

token = verify_api_key(request, "checkout.storefront", channel_idx)  # the token, or None

Requirements

  • Python 3.11 or newer, Django 5.1 or newer.
  • Django REST Framework, SimpleJWT, drf-spectacular and Pydantic 2.
  • A shared cache (Redis) in production.
  • PostgreSQL 15 or newer for the one-token-per-hash-and-channel constraint.
  • Entirius packages pulled in: entirius-django-utils.

Documentation

Part of Entirius

This module runs inside the Entirius backend service (Volkanos) and verifies the keys of the modules next to it.

Development

make install     # sync dependencies (uv)
make check       # lint + format check (ruff)
make test        # test suite (pytest + pytest-django)

Development and agent instructions: https://github.com/entirius/entirius-django-access/blob/develop/AGENTS.md

License

Mozilla Public License 2.0 (MPL-2.0) — see https://github.com/entirius/entirius-django-access/blob/develop/LICENSE.

Metadata

Release files for entirius-django-access 1.1.0

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

Source distribution (sdist)

Source distribution for entirius-django-access 1.1.0
File Size Uploaded Provenance Actions
entirius_django_access-1.1.0.tar.gz 256.4 kB Without provenance Details for entirius_django_access-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for entirius-django-access 1.1.0
File Interpreter ABI Platform Actions
entirius_django_access-1.1.0-py3-none-any.whl Python 3 none any Details for entirius_django_access-1.1.0-py3-none-any.whl

Total release size: 368.9 kB

Release files / entirius_django_access-1.1.0.tar.gz

Download URL entirius_django_access-1.1.0.tar.gz
Size 256.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b9cdabf6543b2916607f7be8ed5003a094c39ed031cb92104612994b0c4a68aa
BLAKE2b-256 checksum
How to use checksums
9e7d2b2867ed41507fd092fdfda42a3163c3ce896cf17027a9f39aac42826825
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / entirius_django_access-1.1.0-py3-none-any.whl

Download URL entirius_django_access-1.1.0-py3-none-any.whl
Size 112.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
54a4eacfe70a0d6348476499485215b29a42febe58d27955b0d297eea390a504
BLAKE2b-256 checksum
How to use checksums
9be4aa659d51c7091dde047ae85f901ba385b32d8ae4072b4b69580044c8bbc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for entirius-django-access 1.1.0

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