{ "info": { "author": "Maxim Kamenkov", "author_email": "mkamenkov@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4" ], "description": "rest\\_condition\n===============\n\nComplex permissions flow for `django-rest-framework`_.\n\nInstallation\n------------\n\nThe easiest way to install the latest version is by using\npip/easy\\_install to pull it from PyPI:\n\n::\n\n pip install rest_condition\n\nYou may also use Git to clone the repository from Github and install it\nmanually:\n\n::\n\n git clone https://github.com/caxap/rest_condition.git\n python setup.py install\n\nExample\n-------\n\n.. code:: python\n\n from rest_framework.response import Response\n from rest_framework.views import APIView\n from rest_framework.permissions import BasePermission\n from rest_condition import ConditionalPermission, C, And, Or, Not\n\n\n class Perm1(BasePermission):\n\n def has_permission(self, request, view):\n # You permissions check here\n return True\n\n\n class Perm2(BasePermission):\n\n def has_permission(self, request, view):\n # You permissions check here\n return False\n\n\n # Example of possible expressions\n expr1 = Or(Perm1, Perm2) # same as: C(Perm1) | Perm2\n expr2 = And(Perm1, Perm2) # same as: C(Perm1) & Perm2\n expr3 = Not(Perm1) # same as: ~C(Perm1)\n expr4 = And(Not(Perm1), Or(Perm1, Not(Perm2))) # same as: ~C(Perm1) & (C(Perm1) | ~C(Perm2))\n\n # Using expressions in API views\n class ExampleView(APIView):\n permission_classes = [Or(And(Perm1, Perm2), Not(Perm2)), ]\n # Or just simple:\n # permission_classes = [C(Perm1) & Perm2 | ~C(Perm2), ]\n\n def get(self, request, format=None):\n content = {'status': 'request was permitted'}\n return Response(content)\n\n\n class OtherExampleView(ExampleView):\n # Using ConditionalPermission class\n permission_classes = [ConditionalPermission, ]\n permission_condition = (C(Perm1) & Perm2) | (~C(Perm1) & ~C(Perm2))\n\nLicense\n-------\n\nThe MIT License (MIT)\n\nContributed by `Max Kamenkov`_\n\n.. _django-rest-framework: http://django-rest-framework.org/\n.. _Maxim Kamenkov: https://github.com/caxap/", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/caxap/rest_condition", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "rest_condition", "package_url": "https://pypi.org/project/rest_condition/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/rest_condition/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/caxap/rest_condition" }, "release_url": "https://pypi.org/project/rest_condition/1.0.3/", "requires_dist": null, "requires_python": null, "summary": "Complex permissions flow for django-rest-framework", "version": "1.0.3" }, "last_serial": 2435323, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "bb090bbd1096af8d59c10d65f5695639", "sha256": "3bc2064e8ed72477c989a45190c279b000aa3397f02bc3abc22d96a20bafe33a" }, "downloads": -1, "filename": "rest_condition-1.0.0.tar.gz", "has_sig": false, "md5_digest": "bb090bbd1096af8d59c10d65f5695639", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2875, "upload_time": "2013-12-09T15:43:58", "url": "https://files.pythonhosted.org/packages/96/e6/810430a90489d50703dd08bcdf56d512fdc3ee019afb3bd477a24e38e449/rest_condition-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "85fa65e38d0f4d7358e146cb36a93e72", "sha256": "5b8a28468f50ef96317cdacd5692773498e606ba39bd212a448b6533eb6c1688" }, "downloads": -1, "filename": "rest_condition-1.0.1.tar.gz", "has_sig": false, "md5_digest": "85fa65e38d0f4d7358e146cb36a93e72", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2877, "upload_time": "2014-11-08T20:57:39", "url": "https://files.pythonhosted.org/packages/00/f8/0329777e769da929d847723ee24973b5665c4bc5ea23c3b0d5aaede40d96/rest_condition-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "2f101d466f6502faddc43b15d79c98fc", "sha256": "fe647350e7bbd7639076e5ddb39643a8117aad60cf55a60a6fbc4e756d0958df" }, "downloads": -1, "filename": "rest_condition-1.0.2.tar.gz", "has_sig": false, "md5_digest": "2f101d466f6502faddc43b15d79c98fc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4773, "upload_time": "2015-10-29T09:10:17", "url": "https://files.pythonhosted.org/packages/7b/7d/ce33bd85352478716bf6221ffe8860e598b0f7bb7522277d5311a8bf05bd/rest_condition-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "41cd00fd2049ed0a2af5fdfb20e97a3e", "sha256": "7f47ed11a6519260b3f6248a2b6d6bf127ea7d9e04155fcf1e546bb561295af8" }, "downloads": -1, "filename": "rest_condition-1.0.3.tar.gz", "has_sig": false, "md5_digest": "41cd00fd2049ed0a2af5fdfb20e97a3e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4855, "upload_time": "2016-11-01T15:15:50", "url": "https://files.pythonhosted.org/packages/f2/e8/9f46207275f33df32a36d3755d5da8b551de053c61ec4cad8f71fe6e411f/rest_condition-1.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "41cd00fd2049ed0a2af5fdfb20e97a3e", "sha256": "7f47ed11a6519260b3f6248a2b6d6bf127ea7d9e04155fcf1e546bb561295af8" }, "downloads": -1, "filename": "rest_condition-1.0.3.tar.gz", "has_sig": false, "md5_digest": "41cd00fd2049ed0a2af5fdfb20e97a3e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4855, "upload_time": "2016-11-01T15:15:50", "url": "https://files.pythonhosted.org/packages/f2/e8/9f46207275f33df32a36d3755d5da8b551de053c61ec4cad8f71fe6e411f/rest_condition-1.0.3.tar.gz" } ] }