Skip to main content

Parameterized Role-Based Access Control for Django

Project description

(Parameterized Role-Based Access Control)

https://github.com/dimagi/django-prbac

Build Status Test coverage PyPi version

About RBAC and PRBAC

Role-based access control (RBAC) is the standard method for access control in large systems. With RBAC, you grant privileges to roles. For example you might grant the privilege Reporting to the role Analyst. In most systems, you can nest roles as deeply as you want, and give users however many roles. A good example of this in practice is PostgreSQL roles and privileges.

The roles and privileges are whatever abstract concepts make sense for your system. It is up to application code to determine what actions to take based on the privileges granted. This can, of course, be implemented in terms of a lower-level permission system such as row-level or object-level access control lists (ACLs).

Parameterized role-based access control (PRBAC) adds parameters to roles and privileges. Now, for example, you might grant "Reporting(organization="Dimagi",area="Finance") to FinancialAnalyst(organization="Dimagi"). If you don’t use parameters, then it is just RBAC. If you use parameters with finite sets of choice, then it is exponentially more powerful. If you use parameters with infinitely many choices (such as strings or integers) then it is infinitely more powerful. A good example of limited parameterization is how particular privileges (SELECT, UPDATE, etc) in PostgreSQL may be parameterized by an object. In PRBAC this parameterization is pervasive.

In-depth documentation

To learn more about parameterized role-based access control as implemented in this library, please visit http://django-prbac.readthedocs.org/

Access Control for Django

  • django.contrib.auth: This app, shipped with Django, provides unix-style access control (users, groups, permissions) with an extensible set of permissions that are implicitly parameterized by a content type. This is fundamentally different than role-based access control. It is only worth mentioning because it comes with Django and everyone is going to want to know “why did you reimplement the wheel?”. If django.contrib.auth is the wheel, then RBAC is the car and PRBAC is a transformer. I leave it as an exercise to the reader to attempt to implement PRBAC using django.contrib.auth :-)

  • django-rbac: This project appears defunct and is not parameterized in any rate.

  • django-role-permissions: This app implements a sort of RBAC where roles are statically defined in code.

  • Others can be perused at https://www.djangopackages.com/grids/g/perms/. Many offer object-level permissions, which is as orthogonal to role-based access control as unix permissions. In fact, this is probably true of anything using the term “permissions”.

Quick Start

To install, use pip:

$ pip install django-prbac

License

Django-prbac is distributed under the MIT license. (See the LICENSE file for details)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-prbac-0.0.8.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

django_prbac-0.0.8-py2.py3-none-any.whl (19.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-prbac-0.0.8.tar.gz.

File metadata

  • Download URL: django-prbac-0.0.8.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for django-prbac-0.0.8.tar.gz
Algorithm Hash digest
SHA256 4d883a262545f4a4d17d982631c01e9794e4559501e28fd68a860bca026ef2cf
MD5 ec911a21b55f183f2df8c44507f4590d
BLAKE2b-256 5c1817b09cc2c5f91d1023d2942ada7d6ca297b3a655dd7cfcc22dd60f2fa9c2

See more details on using hashes here.

File details

Details for the file django_prbac-0.0.8-py2.py3-none-any.whl.

File metadata

  • Download URL: django_prbac-0.0.8-py2.py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for django_prbac-0.0.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 24018c4be960d4bee707ba1bcc46ed0037fbebb4ae568d02a0e602662ec27f5a
MD5 596acddfa8b5e7eaa86b76e8ea37d005
BLAKE2b-256 d439407fd5ff1c0feeca2ca8e8b351aa01fb66cea8bce7a1dd5678bafd8d5e0d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page