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.
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,observeandoff(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
- Module docs: https://github.com/entirius/entirius-django-access/tree/develop/docs
- Entirius documentation: https://docs.entirius.com/
- Changelog: https://github.com/entirius/entirius-django-access/blob/develop/CHANGELOG.md
Part of Entirius
This module runs inside the Entirius backend service (Volkanos) and verifies the keys of the modules next to it.
- Backend service: https://github.com/entirius/entirius-service-volkanos
- Docker harness: https://github.com/entirius/entirius-zeno
- Sibling modules: https://github.com/entirius/entirius-django-checkout, https://github.com/entirius/entirius-django-accounts, https://github.com/entirius/entirius-django-contact-forms
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.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| entirius_django_access-1.0.0.tar.gz | 239.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| entirius_django_access-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 343.7 kB
Release files / entirius_django_access-1.0.0.tar.gz
| Download URL | entirius_django_access-1.0.0.tar.gz |
|---|---|
| Size | 239.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
52f6b7ae797995ae38e2920b3a87530942f7784666b0b4410d1f2d9671fc4c88
|
|
BLAKE2b-256 checksum How to use checksums |
61ba2056a78c314bb1899d56f7bada0d14ea66a51af01685304e41f126f9e17d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","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.0.0-py3-none-any.whl
| Download URL | entirius_django_access-1.0.0-py3-none-any.whl |
|---|---|
| Size | 103.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ffbd221d6b690e6fb0647890eed45afd0ec984c42882f0cbd3d6528500cf0870
|
|
BLAKE2b-256 checksum How to use checksums |
fb273f4e4059f1d75eb795ba2c7ce6b370a9602944c6d9a0acff21a3054ce6c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","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}
|