{ "info": { "author": "David Danier", "author_email": "david.danier@team23.de", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Utilities" ], "description": "About\n=====\n\ndjango_callable_perms implements a modular registry of permission handlers.\nHandlers can be registered as simple permission callbacks, following\nthe Django has_perm parameters.\n\nAll permission callbacks may implement the permission checks they need. As\nwe talk about callbacks, meaning executable code, you can put everything\nyou need in there.\n\nExample\n=======\n\nDjango itself misses support for row level permissions. You may add this using\nauthentication backends and there are existing apps to implement this. Anyways\nmost of these solutions will add some overhead and cannot provide really\nflexible permissions.\n\ndjango_callable_perms do not care about which permissions you want to implement\nbut fit row level permissions really well. So lets start with the real example.\nGiven a model like this:\n\n::\n \n class Article(models.Model):\n title = models.CharField(max_length=100)\n author = models.ForeignKey(User)\n\nYou may want to add permissions checks, so only the author is allowed to\nedit his/her articles. Now django_callable_perms may be used to add simple\nchecks like the following:\n\n::\n \n # may be put into permissions.py inside the app\n from django_callable_perms import register\n from .models import Article\n \n \n def author_may_always_edit(user, perm, obj):\n # no additional database query needed!\n if obj.author_id == user.pk:\n return True\n \n \n register(\n 'app.change_article', # permission name\n author_may_always_edit, # callback function\n Article, # model, for which the permission check is implemented\n # may be \"None\", if no instance is required\n )\n\nPermission checks afterwards just follow default Django behavior. Use\n{% get_obj_perms %} inside templates.\n\n::\n \n {% get_obj_perms for user accessing obj as obj_perms %}\n {% if obj_perms.app.change_article %}\n {# show edit link #}\n Edit\n {% endif %}\n\nNote: If you need your own permissions you do not need to add them to the\ndatabase (see Django docs), most of the time it's enough to just register\nthe new permissions.\n\nInstallation\n============\n\nAdd ``django_callable_perms`` to ``INSTALLED_APPS`` (for autoloading) and add\n``django_callable_perms.backends.CallablePermissionBackend`` to your\n``AUTHENTICATION_BACKENDS``.\n\nMake sure to put django_callable_perms into your Python PATH first, of\ncourse.\n\nAdditional Features\n===================\n\nAutoloading\n+++++++++++\n\nWill load all permissions.py's inside the INSTALLED_APPS.\n\nsync_permissions\n++++++++++++++++\n\nManagement command to create all app permission inside the database. May be\nused to initialize the database. Will not (meaning never) add more than the\ndefault Django permissions.", "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/ddanier/django_callable_perms", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "django_callable_perms", "package_url": "https://pypi.org/project/django_callable_perms/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django_callable_perms/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/ddanier/django_callable_perms" }, "release_url": "https://pypi.org/project/django_callable_perms/0.1.2/", "requires_dist": null, "requires_python": null, "summary": "Modular registry of permission handlers for Django", "version": "0.1.2" }, "last_serial": 4304490, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "a8d891862004c4d924b0a8808241239b", "sha256": "0c4a8175e61b0dc6d176e4e57b1bf8edbabcf6112d040e0b86b86f0a56e41aee" }, "downloads": -1, "filename": "django_callable_perms-0.1.0.tar.gz", "has_sig": false, "md5_digest": "a8d891862004c4d924b0a8808241239b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4561, "upload_time": "2012-12-08T21:28:44", "url": "https://files.pythonhosted.org/packages/3d/71/488fc46b931f625584af548bff5288c50c975c4e2fe17579234d69c74f5f/django_callable_perms-0.1.0.tar.gz" } ], "0.1.0-2": [ { "comment_text": "", "digests": { "md5": "533828e73495e7b0ce3e7d8a156b8406", "sha256": "12fc9e7514313ee388078fb95ce68f997ee66ff932f050840fb0560a7debd715" }, "downloads": -1, "filename": "django_callable_perms-0.1.0-2.tar.gz", "has_sig": false, "md5_digest": "533828e73495e7b0ce3e7d8a156b8406", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4376, "upload_time": "2012-12-10T15:38:47", "url": "https://files.pythonhosted.org/packages/73/a3/28daa88903c7aaf819ab5e471da606f97ce782a702c99427f2cfa27c6aac/django_callable_perms-0.1.0-2.tar.gz" } ], "0.1.0-3": [ { "comment_text": "", "digests": { "md5": "6e51fc403b5cff1a411d3cc4072695d1", "sha256": "8d0b00f3e5af559c4713bf793b368e2f73a3591731e592819d5dd7381e9c541b" }, "downloads": -1, "filename": "django_callable_perms-0.1.0-3.tar.gz", "has_sig": false, "md5_digest": "6e51fc403b5cff1a411d3cc4072695d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4600, "upload_time": "2012-12-11T13:58:50", "url": "https://files.pythonhosted.org/packages/0e/ca/54a9469a4adb6ddb8c65cd5e5c14e31fd3de8c7f36095106ee6d433de918/django_callable_perms-0.1.0-3.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "b7f3936d8b2d220bdd633301fa62b526", "sha256": "8f8e47634f042d2db5088148f4b26414a08f2cd0b66568769030af673b83f504" }, "downloads": -1, "filename": "django_callable_perms-0.1.1.tar.gz", "has_sig": false, "md5_digest": "b7f3936d8b2d220bdd633301fa62b526", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4577, "upload_time": "2012-12-11T14:35:30", "url": "https://files.pythonhosted.org/packages/49/6b/0398810ae22227cd8a91aa549fc8cf6d8309553b450c84c2ef594fd52837/django_callable_perms-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "300d4498279beb92714646aa95ba1e6c", "sha256": "e61ce37faad74f3c90512dba442b70e4c811e9464c7791697650d52260967998" }, "downloads": -1, "filename": "django_callable_perms-0.1.2.tar.gz", "has_sig": false, "md5_digest": "300d4498279beb92714646aa95ba1e6c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4597, "upload_time": "2014-07-17T11:05:45", "url": "https://files.pythonhosted.org/packages/e6/9e/80490e9fc9a9f6bb5222f51c1190941cc3dd744cc0f07c3112c092403e7e/django_callable_perms-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "300d4498279beb92714646aa95ba1e6c", "sha256": "e61ce37faad74f3c90512dba442b70e4c811e9464c7791697650d52260967998" }, "downloads": -1, "filename": "django_callable_perms-0.1.2.tar.gz", "has_sig": false, "md5_digest": "300d4498279beb92714646aa95ba1e6c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4597, "upload_time": "2014-07-17T11:05:45", "url": "https://files.pythonhosted.org/packages/e6/9e/80490e9fc9a9f6bb5222f51c1190941cc3dd744cc0f07c3112c092403e7e/django_callable_perms-0.1.2.tar.gz" } ] }