{ "info": { "author": "Joshua Carp", "author_email": "jm.carp@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "=========\nguardrail\n=========\n\n.. image:: https://badge.fury.io/py/guardrail.png\n :target: http://badge.fury.io/py/guardrail\n :alt: Latest version\n\n.. image:: https://travis-ci.org/jmcarp/guardrail.png\n :target: https://travis-ci.org/jmcarp/guardrail\n :alt: Travis CI\n\nguardrail is a Python library for managing object-level permissions that's\ndesigned to integrate with arbitrary databases and web frameworks. guardrail\nis inspired by `django-guardian `_\nand currently supports the SQLAlchemy, Peewee, Pony, and Django ORMs.\n\nHomepage: https://guardrail.readthedocs.org/\n\nInstall\n-------\n\n::\n\n pip install guardrail\n\nguardrail supports Python >= 2.7 or >= 3.3 and pypy.\n\n\nExamples\n--------\n\nDefine your models as usual, using the `registry.agent` and `registry.target`\ndecorators to set up permissions relationships:\n\n.. code-block:: python\n\n import peewee as pw\n\n from guardrail.core import registry\n from guardrail.ext.peewee import PeeweePermissionSchemaFactory\n\n database = pw.SqliteDatabase(':memory:')\n class Base(pw.Model):\n class Meta:\n database = database\n\n @registry.agent\n class User(Base):\n name = pw.CharField()\n\n @registry.target\n class Post(Base):\n name = pw.CharField()\n\n @registry.target\n class Comment(Base):\n name = pw.CharField()\n\n factory = PeeweePermissionSchemaFactory((Base, ))\n registry.make_schemas(factory)\n\n database.connect()\n database.create_tables([User, Post, Comment], safe=True)\n database.create_tables(registry.permissions, safe=True)\n\nThen use the permission manager to perform CRUD operations on permissions\nbetween any `agent` and `target` models:\n\n.. code-block:: python\n\n from guardrail.ext.peewee import PeeweePermissionManager\n\n manager = PeeweePermissionManager()\n\n user = User.create(name='fred')\n post = Post.create(name='news of the world')\n comment = Comment.create(name='dragon attack')\n\n manager.add_permission(user, post, 'edit')\n manager.add_permission(user, comment, 'delete')\n\n manager.has_permission(user, post, 'edit') # True\n\n manager.remove_permission(user, comment, 'delete')\n\n manager.has_permission(user, comment, 'delete') # False\n\n\nProject Links\n-------------\n\n- PyPI: https://pypi.python.org/pypi/guardrail\n- Issues: https://github.com/jmcarp/guardrail/issues\n\n\nLicense\n-------\n\nMIT licensed. See the `LICENSE `_\nfile for details.", "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/jmcarp/guardrail", "keywords": null, "license": "Copyright (c) 2015 Joshua Carp\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.", "maintainer": null, "maintainer_email": null, "name": "guardrail", "package_url": "https://pypi.org/project/guardrail/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/guardrail/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/jmcarp/guardrail" }, "release_url": "https://pypi.org/project/guardrail/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "An extensible library for managing object-level permissions with support for SQLAlchemy, Peewee, Pony, and Django.", "version": "0.1.1" }, "last_serial": 1491964, "releases": { "0.1.0": [ { "comment_text": "built for Darwin-14.1.0", "digests": { "md5": "25daf314c2cf580d0cd8e186e1b264f4", "sha256": "7a74d3ed2253509f3b6b39928d43af66ad5ab67bfc951b22d936b8cd8e4e6ee8" }, "downloads": -1, "filename": "guardrail-0.1.0.macosx-10.5-x86_64.tar.gz", "has_sig": false, "md5_digest": "25daf314c2cf580d0cd8e186e1b264f4", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 20884, "upload_time": "2015-04-01T21:43:14", "url": "https://files.pythonhosted.org/packages/d8/d3/d4e71c0074492f13cc07869542bce7202652e6f2e21f3157220bfab39ae8/guardrail-0.1.0.macosx-10.5-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "8ff6666829623dacfb03f131276aa5be", "sha256": "d6de99a43ac6725dc418a1e3687adb70c7dd7b33d7c23566f3c9655d37782c11" }, "downloads": -1, "filename": "guardrail-0.1.0.tar.gz", "has_sig": false, "md5_digest": "8ff6666829623dacfb03f131276aa5be", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10995, "upload_time": "2015-04-01T21:43:12", "url": "https://files.pythonhosted.org/packages/f2/df/206e5b27e86d7d5d2c5244619c40f8ddafaacf4c5c41e1e0802d51b8a650/guardrail-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "built for Darwin-14.1.0", "digests": { "md5": "8a457648cf380c3e9cbda4bda626b101", "sha256": "e2016b5555f4efc7c1876ad94ef8033b35d7c89970d96e27494f89a7ba08fb43" }, "downloads": -1, "filename": "guardrail-0.1.1.macosx-10.5-x86_64.tar.gz", "has_sig": false, "md5_digest": "8a457648cf380c3e9cbda4bda626b101", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 25042, "upload_time": "2015-04-05T19:29:16", "url": "https://files.pythonhosted.org/packages/23/ef/0dd6a4a149f8df00bcf01668c504de2040f7b5057f936d960db1bc5dd9b1/guardrail-0.1.1.macosx-10.5-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "14177c9e583b2a715eb50e7e975c2a83", "sha256": "2279eae52aa00108a9197c3ea594db561df60720e79d970de620423b6842abe9" }, "downloads": -1, "filename": "guardrail-0.1.1.tar.gz", "has_sig": false, "md5_digest": "14177c9e583b2a715eb50e7e975c2a83", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12905, "upload_time": "2015-04-05T19:29:13", "url": "https://files.pythonhosted.org/packages/56/68/40cd6d0aa7d3bf7bd62d2214671b7cf1402b47dd0cac74c97b8632d893fa/guardrail-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "built for Darwin-14.1.0", "digests": { "md5": "8a457648cf380c3e9cbda4bda626b101", "sha256": "e2016b5555f4efc7c1876ad94ef8033b35d7c89970d96e27494f89a7ba08fb43" }, "downloads": -1, "filename": "guardrail-0.1.1.macosx-10.5-x86_64.tar.gz", "has_sig": false, "md5_digest": "8a457648cf380c3e9cbda4bda626b101", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 25042, "upload_time": "2015-04-05T19:29:16", "url": "https://files.pythonhosted.org/packages/23/ef/0dd6a4a149f8df00bcf01668c504de2040f7b5057f936d960db1bc5dd9b1/guardrail-0.1.1.macosx-10.5-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "14177c9e583b2a715eb50e7e975c2a83", "sha256": "2279eae52aa00108a9197c3ea594db561df60720e79d970de620423b6842abe9" }, "downloads": -1, "filename": "guardrail-0.1.1.tar.gz", "has_sig": false, "md5_digest": "14177c9e583b2a715eb50e7e975c2a83", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12905, "upload_time": "2015-04-05T19:29:13", "url": "https://files.pythonhosted.org/packages/56/68/40cd6d0aa7d3bf7bd62d2214671b7cf1402b47dd0cac74c97b8632d893fa/guardrail-0.1.1.tar.gz" } ] }