8000 GitHub - rcmachado/django-pieguard: django-pieguard is a simple authorization class for tastypie that uses django-guardian to handle object permissions.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

django-pieguard is a simple authorization class for tastypie that uses django-guardian to handle object permissions.

License

Notifications You must be signed in to change notification settings

rcmachado/django-pieguard

Repository files navigation

django-pieguard

django-pieguard is a simple authorization class for tastypie that uses django-guardian to handle object permissions.

This was inspired by gist https://gist.github.com/7wonders/6557760.

Requirements

Not tested in other versions yet.

Quickstart

Install django-pieguard:

pip install django-pieguard

Then use it in a tastypie project:

from pieguard.authorization import GuardianAuthorization
from tastypie.resources import Resource
from django.db import models

class MyModel(models.Model):
    class Meta:
        permissions = (
            ('view_mymodel', 'View my model'),
        )

class MyResource(ModelResource):
    class Meta:
        authorization = GuardianAuthorization
        # ... your other options

Notes on permissions

django-pieguard uses a special view_modelname permission to control if user can view that resource or not. As Django only creates add, change and delete permissions by default, you need to add the relevant permission on your model Meta class.

TODO

  • Tests
  • Docs
  • Python 3 official support

License

This work is licensed under MIT license.

About

django-pieguard is a simple authorization class for tastypie that uses django-guardian to handle object permissions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published
3D8E

Packages

No packages published

Contributors 2

  •  
  •  
0