Skip to content

PrimarySite/drf-deny-allow-pc

Repository files navigation

An alternate approach to building permission classes with permission chaining using an 'OR' logic

In Django rest Framework the permission classes work as:

If any permission check fails an [...] exception will be raised, and the main body of the view will not run. They all have to allow access for the permission to work ('AND').

This implementation of permission classes takes a list of functions that determine if the access is allowed. If any of the functions returns True, the access is allowed, if none of the permission checks passes the access will be denied. This enables to write small, reusable and chainable permissions. You have to be explicit which users have access.

https://travis-ci.org/PrimarySite/drf-deny-allow-pc.svg?branch=master https://codecov.io/github/PrimarySite/drf-deny-allow-pc/coverage.svg?branch=master Documentation Status

To build the sphinx documentation execute make html in the docs directory.

About

DRF Deny All - Allow Specific Permission Classes

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages