Metadata-Version: 2.0
Name: drf-composable-permissions
Version: 0.1
Summary: UNKNOWN
Home-page: https://github.com/jgadelange/drf-composable-permissions
Author: Jeffrey de Lange
Author-email: jeffrey@jeffreydelange.nl
License: BSD
Platform: UNKNOWN
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3

DRF Composable Permissions
==========================

Compose your permission classes for django-rest-framework.

Usage
-----

To compose a new ``Permission`` class to be used by the django rest
framework views you have to wrap the original class in a ``P`` class
then can use the logical operators from python: - ``~`` (not) - ``|``
(or) ~ ``&`` (and)

This package also contains a few permission that can be used.

For example, when we want to create a permission class that allows read
access to authenticated users and write access to superusers we can use
the following code:

::

    from rest_framework.permissions import IsAuthenticated
    from drf_composable_permissions.p import P
    from drf_composable_permissions.permissions import IsReadOnly, IsSuperuser

    MyPermission = P(IsSuperuser) | (P(IsAuthenticated) & P(IsReadOnly))


