skillfed

django-prbac

Parameterized Role-Based Access Control for Django

django-prbac v1.1.2 77.7K downloads/30d#14,504 on PyPI152
License unclear Active released

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-prbac

uv

uv add django-prbac

poetry

poetry add django-prbac

Installing 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

Development Status :: 3 - AlphaEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 4Framework :: Django :: 4.2Framework :: Django :: 5Framework :: Django :: 5.1Framework :: Django :: 5.2Intended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules

Tags

django role-based access controlparameterized rbac djangodjango permission systemdjango access controlrole-based authorization djangodjango privilege managementdjango prbac
access-controldjango-extensionrbac

More Python Modules packages