This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!
Project Description

django-field-object-permissions is an object permission system based on field values of the object. (eg: object.owner == user)

Install

To install just run:

pip install django-field-object-permissions

Configuration

  1. Put fieldobjectpermissions to your INSTALLED_APPS of the settings module:

    INSTALLED_APPS = (
       ...
       'fieldobjectpermissions',
    )
    

2. Replace the default authentication backend (fieldobjectpermissions is based on it):

AUTHENTICATION_BACKENDS = (
    # django.contrib.auth.backends.ModelBackend,  # Default
    fieldobjectpermissions.backends.FieldObjectPermissionsBackend,
)
  1. These new values are optional, defaults are shown below:

    FIELD_OBJECT_PERMISSIONS = {
        'OWNER_FIELDS': ('owner',),
        'GROUP_FIELDS': ('group',),
        'OWNER_ACTIONS': ('change', 'delete'),
        'GROUP_ACTIONS': ('change', 'delete'),
    }
    

4. Run python manage.py migrate as there are post-migration triggers to create the extra permissions required.

Usage

You can now assign permissions like owner_change_foo to allow only the user who matches the value of the owner field to change an object (or the superuser, of course).

Or the permission group_delete_foo to all allow any user who is a member of a group listed in the group field of an object to delete it (or the superuser, you know this).

These permissions are created in a post-migrate signal handler, and will only be created for models with have the required field(s).

By specifying multiple fields for OWNER_FIELDS or GROUP_FIELDS only one of the listed fields needs to exist for permission creation. And only one needs to match for permission to be granted by the auth backend.

Release History

Release History

0.1.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-field-object-permissions-0.1.1.tar.gz (4.9 kB) Copy SHA256 Checksum SHA256 Source Apr 10, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting