django-prbac
Parameterized Role-Based Access Control for Django
What it is and what it does
Django-prbac brings parameterized role-based access control to Django applications. Unlike Django's built-in permission system, which is tied to content types, PRBAC lets you define roles and privileges as abstract concepts and add parameters to them—so you can grant something like 'Reporting(organization="Dimagi", area="Finance")' to a specific role. This is more expressive than traditional RBAC because the parameters can be finite sets or infinite (strings, integers, etc.), making it exponentially or infinitely more powerful depending on how you use it.
The package depends on Django, jsonfield, and simplejson to store and manage these parameterized roles and privileges. It is actively maintained, supports modern Python versions (3.9–3.13) and recent Django releases (4.2 through 5.2), and has no known security vulnerabilities. The library is marked as alpha-stage but has been in development since 2013, so it is reasonably stable for production use.
Use it for:
- Multi-tenant SaaS applications where different organizations need different access levels to the same features.
- Complex reporting systems where analysts need access to specific data subsets parameterized by region, department, or time period.
- Enterprise applications with hierarchical role structures where roles inherit privileges conditionally based on parameters.
- Systems requiring fine-grained object-level access control tied to role membership and parameter matching.
- Applications that need to audit and manage who has access to what without hardcoding permissions in code.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Implements parameterized role-based access control (PRBAC) for Django applications, allowing you to define roles and privileges with parameters to control who can do what across your system.
Yes, if you need parameterized role-based access control beyond what Django's built-in auth provides. The package is actively maintained, has low install friction, supports current Python and Django versions, and carries no known vulnerabilities. It is marked alpha but has been stable since 2013. The main caveat is that the license treatment is unclear in the metadata, so verify the actual license (described as MIT in the documentation) before use.
Install
django-prbac on PyPI
pip
pip install django-prbacuv
uv add django-prbacpoetry
poetry add django-prbacInstalling django-prbac
Before you install
Low friction install with three straightforward runtime dependencies (django, jsonfield, simplejson). The package is actively maintained with recent commits and marked as alpha-stage, so it is suitable for production use but may see API changes.
Quickstart
pip install django-prbac
from django_prbac.models import Role, Privilege
# Define a role with parameters
role = Role.objects.create(name='Analyst')
privilege = Privilege.objects.create(name='Reporting', role=role)
Requires Django 4.2 or later and Python 3.9 or later; must be used within a Django project with a configured database.
Verify before relying
- Specific examples of how parameters are passed and evaluated in practice beyond the documentation excerpt.
- Whether the package provides decorators or middleware for enforcing access control in views.
- Performance characteristics when dealing with deeply nested roles or large numbers of parameterized privileges.
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — django, jsonfield, simplejson |
| Maintenance | actively maintained — 324 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 77,705/month — #14,504 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_prbac-1.1.2-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
authAn HTTP authorization service that answers…
permissive · top 15,000 on PyPI
djangorestframework-role-filtersAdds role-based access control to Django REST…
permissive · top 5,000 on PyPI
pycasbinPyCasbin enforces access control policies using…
permissive · top 5,000 on PyPI
Flask-PrincipalFlask-Principal provides identity and…
permissive · top 15,000 on PyPI
dry-rest-permissionsDefines rules-based permissions for Django REST…
permissive · top 15,000 on PyPI
django-guardiandjango-guardian adds per-object permission…
permissive · top 5,000 on PyPI
casbinCasbin enforces access control policies (ACL,…
permissive · top 5,000 on PyPI
django-organizationsAdds multi-user group and account management to…
permissive · top 15,000 on PyPI
AccessControlAccessControl provides a security framework for…
unclear · top 15,000 on PyPI
elevateElevate re-launches the current Python process…
permissive · top 15,000 on PyPI