Metadata-Version: 1.1
Name: guardrail
Version: 0.1.0
Summary: An extensible library for managing object-level permissions with support for SQLAlchemy, Peewee, Pony, and Django.
Home-page: https://github.com/jmcarp/guardrail
Author: Joshua Carp
Author-email: jm.carp@gmail.com
License: Copyright (c) 2015 Joshua Carp

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Description: =========
        guardrail
        =========
        
        .. image:: https://badge.fury.io/py/guardrail.png
            :target: http://badge.fury.io/py/guardrail
            :alt: Latest version
        
        .. image:: https://travis-ci.org/jmcarp/guardrail.png
            :target: https://travis-ci.org/jmcarp/guardrail
            :alt: Travis CI
        
        guardrail is a Python library for managing object-level permissions that's
        designed to integrate with arbitrary databases and web frameworks. guardrail
        is inspired by `django-guardian <https://github.com/lukaszb/django-guardian>`_
        and currently supports the SQLAlchemy, Peewee, Pony, and Django ORMs.
        
        guardrail is easy to integrate with any Python web framework. Documentation and
        usage examples coming soon.
        
        Install
        -------
        
        ::
        
            pip install guardrail
        
        guardrail supports Python >= 2.7 or >= 3.3 and pypy.
        
        
        Examples
        --------
        
        Define your models as usual, using the `registry.agent` and `registry.target`
        decorators to set up permissions relationships:
        
        .. code-block:: python
        
            import peewee as pw
        
            from guardrail.core import registry
            from guardrail.ext.peewee import PeeweePermissionSchemaFactory
        
            database = pw.SqliteDatabase(':memory:')
            class Base(pw.Model):
                class Meta:
                    database = database
        
            @registry.agent
            class User(Base):
                name = pw.CharField()
        
            @registry.target
            class Post(Base):
                name = pw.CharField()
        
            @registry.target
            class Comment(Base):
                name = pw.CharField()
        
            factory = PeeweePermissionSchemaFactory((Base, ))
            registry.make_schemas(factory)
        
            database.connect()
            database.create_tables([User, Post, Comment], safe=True)
            database.create_tables(registry.permissions, safe=True)
        
        Then use the permission manager to perform CRUD operations on permissions
        between any `agent` and `target` models:
        
        .. code-block:: python
        
            from guardrail.ext.peewee import PeeweePermissionManager
        
            manager = PeeweePermissionManager()
        
            user = User.create(name='fred')
            post = Post.create(name='news of the world')
            comment = Comment.create(name='dragon attack')
        
            manager.add_permission(user, post, 'edit')
            manager.add_permission(user, comment, 'delete')
        
            manager.has_permission(user, post, 'edit')          # True
        
            manager.remove_permission(user, comment, 'delete')
        
            manager.has_permission(user, comment, 'delete')     # False
        
        
        
        Project Links
        -------------
        
        - PyPI: https://pypi.python.org/pypi/guardrail
        - Issues: https://github.com/jmcarp/guardrail/issues
        
        
        License
        -------
        
        MIT licensed. See the `LICENSE <https://github.com/jmcarp/guardrail/blob/master/LICENSE>`_
        file for details.
        
Keywords: guardrail,authorization,sql,sqlalchemy,peewee,pony,django
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
