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.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 entirius-django-access 1.1.1
File Size Uploaded Provenance Actions
entirius_django_access-1.1.1.tar.gz 257.6 kB Without provenance Details for entirius_django_access-1.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 370.2 kB

Release files / entirius_django_access-1.1.1.tar.gz

Download URL entirius_django_access-1.1.1.tar.gz
Size 257.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5c1e2870b31bfd0a68b1bda520589b1b1f51c310f000e6bd631093e378526600
BLAKE2b-256 checksum
How to use checksums
7ca2ecc1d69cd699d29dcf3a30bd384d8cb3acfdc57d0fd8c9aef76887dd52f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","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.1-py3-none-any.whl

Download URL entirius_django_access-1.1.1-py3-none-any.whl
Size 112.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
90a7f6f39e2d9fe7e9af03fdb452d4e30ebcc5f8f8d0014930ff3d9f86fca450
BLAKE2b-256 checksum
How to use checksums
b82aaa0dca905cc483f96100b3657a7f5ca6639f96f191b4559df279fded16ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","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.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